Added /guilds system command

This commit is contained in:
Marius Begby committed 2023-07-07 09:09:17 +02:00
1 parent e80a28d975
commit 8ea07b4997
1 file changed
+38
+38
View File
@@ -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)
]
});
}
};