From 8ea07b4997946d2e6c5d00d06791f6d43e83784e Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Fri, 7 Jul 2023 09:09:17 +0200 Subject: [PATCH] Added /guilds system command --- system-commands/guilds.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 system-commands/guilds.js diff --git a/system-commands/guilds.js b/system-commands/guilds.js new file mode 100644 index 0000000..5fc51a3 --- /dev/null +++ b/system-commands/guilds.js @@ -0,0 +1,38 @@ +const { SlashCommandBuilder } = require('@discordjs/builders'); +const { EmbedBuilder } = require('discord.js'); +const { + embedColors, + systemServerGuildId, + botOwnerClientId +} = require('../config.json'); + +module.exports = { + data: new SlashCommandBuilder() + .setName('guilds') + .setDescription('Show list of guilds where bot is added.'), + run: async ({ interaction, client }) => { + if ( + interaction.guildId !== systemServerGuildId || + interaction.user.id !== botOwnerClientId + ) { + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription( + `**No permission**\nYou do not have permission to use this command.` + ) + .setColor(embedColors.colorError) + ] + }); + } + let guildsList = client.guilds.cache.map((guild) => guild.name).join(', '); + + return await interaction.editReply({ + embeds: [ + new EmbedBuilder() + .setDescription(`**Guilds**\n${guildsList}`) + .setColor(embedColors.colorInfo) + ] + }); + } +};