mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 12:21:00 -05:00
Check if member has Role A then remove before adding Role B
This commit is contained in:
parent
31a497f470
commit
7c4f060d26
@ -18,15 +18,24 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (interaction.isAutocomplete()){
|
} else if (interaction.isAutocomplete()){
|
||||||
const AC = client.commands.get(interaction.commandName);
|
|
||||||
try {
|
try {
|
||||||
await AC.command.default.autocomplete(client, interaction)
|
await client.commands.get(interaction.commandName).command.default.autocomplete(client, interaction);
|
||||||
} catch (error){
|
} catch (error){
|
||||||
return console.log('An error occurred while running autocomplete:\n', error)
|
return console.log('An error occurred while running autocomplete:\n', error)
|
||||||
}
|
}
|
||||||
} else if (interaction.isButton()){
|
} else if (interaction.isButton()){
|
||||||
if (interaction.customId.startsWith('reaction-') && client.config.botSwitches.buttonRoles){
|
if (interaction.customId.startsWith('reaction-') && client.config.botSwitches.buttonRoles){
|
||||||
const RoleID = interaction.customId.replace('reaction-','');
|
const RoleID = interaction.customId.replace('reaction-','');
|
||||||
|
// Note: This is just a temporary "permanent" fix for the issue of people having both roles and less work for the mods.
|
||||||
|
let buttonRoleBlocked = 'Cannot have both roles! - Button Role';
|
||||||
|
if (interaction.member.roles.cache.has('1149139369433776269') && RoleID === '1149139583729160325') {
|
||||||
|
interaction.member.roles.add('1149139583729160325', buttonRoleBlocked);
|
||||||
|
interaction.member.roles.remove('1149139369433776269', buttonRoleBlocked);
|
||||||
|
} else if (interaction.member.roles.cache.has('1149139583729160325') && RoleID === '1149139369433776269') {
|
||||||
|
interaction.member.roles.add('1149139369433776269', buttonRoleBlocked);
|
||||||
|
interaction.member.roles.remove('1149139583729160325', buttonRoleBlocked);
|
||||||
|
}
|
||||||
|
|
||||||
if (interaction.member.roles.cache.has(RoleID)){
|
if (interaction.member.roles.cache.has(RoleID)){
|
||||||
interaction.member.roles.remove(RoleID, 'Button Role');
|
interaction.member.roles.remove(RoleID, 'Button Role');
|
||||||
interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true})
|
interaction.reply({content: `You have been removed from <@&${RoleID}>`, ephemeral: true})
|
||||||
|
Loading…
Reference in New Issue
Block a user