1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-12-27 20:35:38 -05:00

Prepare for button roles.

This commit is contained in:
toast-ts 2023-05-03 07:35:43 +10:00
parent 1c05375a39
commit 3bdc70a3a1
3 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,7 @@
"registerCommands": true,
"commands": true,
"logs": true,
"buttonRoles": true,
"automod": true,
"mpstats": true,
"autores": true

View File

@ -16,6 +16,17 @@ export default {
return interaction.reply('An error occurred while executing that command.');
}
}
} else if (interaction.isButton()){
if (interaction.customId.startsWith('reaction-') && client.config.botSwitches.buttonRoles){
const RoleID = interaction.customId.replace('reaction-','');
if (interaction.member.roles.cache.has(RoleID)){
interaction.member.roles.remove(RoleID);
interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true})
} else {
interaction.member.roles.add(RoleID);
interaction.reply({content: `You have been added to <@&${RoleID}>`, ephemeral: true})
}
} else console.log(client.logTime(), `Button pressed at ${interaction.message.url}`);
}
}
}

View File

@ -151,6 +151,7 @@ interface botSwitches {
registerCommands: boolean,
commands: boolean,
logs: boolean,
buttonRoles: boolean,
automod: boolean,
mpstats: boolean,
autores: boolean