diff --git a/src/commands/mute.ts b/src/commands/mute.ts index c012035..41d466b 100644 --- a/src/commands/mute.ts +++ b/src/commands/mute.ts @@ -54,7 +54,14 @@ export default class Mute extends Command { }, ]); - const mutedRole = interaction.guild.roles.cache.find(role => role.name == process.env.ROLES_MUTED); + const mutedRoleName = await SettingsHelper.GetSetting('role.muted', interaction.guildId); + + if (!mutedRoleName) { + await interaction.reply('Unable to find configuration. Please contact the bot author.'); + return; + } + + const mutedRole = interaction.guild.roles.cache.find(role => role.name == mutedRoleName); if (!mutedRole) { await interaction.reply('Muted role not found.'); diff --git a/src/commands/unmute.ts b/src/commands/unmute.ts index 7bbb943..2d70154 100644 --- a/src/commands/unmute.ts +++ b/src/commands/unmute.ts @@ -52,7 +52,14 @@ export default class Unmute extends Command { }, ]); - const mutedRole = interaction.guild.roles.cache.find(role => role.name == process.env.ROLES_MUTED); + const mutedRoleName = await SettingsHelper.GetSetting('role.muted', interaction.guildId); + + if (!mutedRoleName) { + await interaction.reply('Unable to find configuration. Please contact the bot author.'); + return; + } + + const mutedRole = interaction.guild.roles.cache.find(role => role.name == mutedRoleName); if (!mutedRole) { await interaction.reply('Muted role not found.');