silvanus/slash-commands/rolemenu.js

18 lines
807 B
JavaScript
Raw Normal View History

const { SlashCommandBuilder } = require('discord.js');
2023-02-12 16:46:06 +00:00
const fn = require('../modules/functions.js');
const strings = require('../data/strings.json');
2023-02-12 16:46:06 +00:00
module.exports = {
data: new SlashCommandBuilder()
.setName('rolemenu')
.setDescription('Send a self-assignable role selection menu'),
2023-02-12 16:46:06 +00:00
async execute(interaction) {
await interaction.deferReply().catch(e => console.error(e));
2023-02-12 20:29:38 +00:00
if (interaction.client.guildInfos.has(interaction.guildId)) {
let guildInfo = interaction.client.guildInfos.get(interaction.guildId);
await interaction.editReply(fn.builders.embeds.treeRoleMenu(guildInfo)).catch(e => console.error(e));
2023-02-12 20:29:38 +00:00
} else {
await interaction.editReply(fn.builders.errorEmbed(strings.status.noRoleMenu)).catch(e => console.error(e));
2023-02-12 20:29:38 +00:00
}
2023-02-12 16:46:06 +00:00
},
};