Files
cadence-discord-bot/system-commands/guilds.js
T
2023-07-07 09:11:31 +02:00

41 lines
1.3 KiB
JavaScript

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)
]
});
}
};