add role check for setup command
This commit is contained in:
@ -40,11 +40,11 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
.setDescription('A Discord bot for role management.')
|
.setDescription('A Discord bot for role management.')
|
||||||
.addFields([
|
.addFields([
|
||||||
{ name: 'Featured commands:', value: commandsList },
|
{ name: 'Featured commands:', value: commandsList },
|
||||||
{ name: 'Further questions?', value: 'Please contact the creator at the linked github repository.' }
|
{ name: 'Further questions?', value: 'Please contact the creator at the linked gitea repository.' }
|
||||||
])
|
])
|
||||||
.setFooter({
|
.setFooter({
|
||||||
iconURL: client.user?.displayAvatarURL(),
|
iconURL: client.user?.displayAvatarURL(),
|
||||||
text: `I was useful wasn't I?`
|
text: `One can never have enough socks.`
|
||||||
})
|
})
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setColor('#000000');
|
.setColor('#000000');
|
||||||
@ -53,6 +53,11 @@ client.on('interactionCreate', async (interaction) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.commandName === CommandsEnum.SETUP) {
|
if (interaction.commandName === CommandsEnum.SETUP) {
|
||||||
|
const adminRole = interaction.guild?.roles.cache.find((role) => role.name === '💎 Moderator');
|
||||||
|
if (adminRole == null) return;
|
||||||
|
const userHasRole = (interaction.member?.roles as GuildMemberRoleManager).cache.has(adminRole.id);
|
||||||
|
if (!userHasRole) return;
|
||||||
|
|
||||||
const commandParameters = interaction.options.data;
|
const commandParameters = interaction.options.data;
|
||||||
const row = new ActionRowBuilder<ButtonBuilder>();
|
const row = new ActionRowBuilder<ButtonBuilder>();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user