player list features

This commit is contained in:
SowinskiBraeden committed 2023-03-20 16:44:56 -07:00
1 parent 6a9c74af68
commit dc00e964af
4 files changed
+106 -10

No files matched your search

+27
View File
@@ -90,6 +90,20 @@ module.exports = {
required: true,
}]
},
{
name: "active_players_channel",
description: "Set the channel for active players update",
value: "active_players_channel",
type: 1,
options: [{
name: "channel",
description: "The channel to configure",
value: "channel",
type: 7,
channel_types: [0], // Restrict to text channel
required: true,
}]
},
{
name: "linked_gt_role",
description: "Access Role to give to users",
@@ -382,6 +396,19 @@ module.exports = {
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'active_players_channel') {
const channel = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.activePlayersChannel": channel}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successEmbed = new EmbedBuilder()
.setDescription(`Successfully set <#${channel}> as the Active Players Channel.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successEmbed] });
} else if (args[0].name == 'linked_gt_role') {
const role = args[0].options[0].value;
+39
View File
@@ -0,0 +1,39 @@
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: "stats",
debug: true,
global: true,
description: "check bot statistics",
usage: "",
permissions: {
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
member: [],
},
options: [],
SlashCommand: {
/**
*
* @param {require("../structures/QuarksBot")} client
* @param {import("discord.js").Message} message
* @param {string[]} args
* @param {*} param3
*/
run: async (client, interaction, args, { GuildDB }, start) => {
let activePlayers = GuildDB.playerstats.filter(p => p.connected);
let des = ``;
for (let i = 0; i < activePlayers.length; i++) {
des += `**- ${activePlayers[i].gamertag}\n`;
}
const activePlayersEmbed = new EmbedBuilder()
.setColor(this.config.Colors.Default)
.setTitle(`Online List - ${activePlayers.length} Player${(activePlayers.length>1||activePlayers.length==0)?'s':''} Online`)
.setDescription(des);
return interaction.send({ embeds: [activePlayersEmbed] });
},
},
}