Add override for bot owner and server owner (#135)

This commit is contained in:
Vylpes 2022-04-21 17:19:03 +01:00 committed by GitHub
parent 18e3f3d800
commit 2dc5d0397b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,18 +40,20 @@ export class Util {
const requiredRoles = itemToUse.Command.Roles; const requiredRoles = itemToUse.Command.Roles;
for (const i in requiredRoles) { if (message.author.id != process.env.BOT_OWNERID && message.author.id != message.guild.ownerId) {
if (message.guild) { for (const i in requiredRoles) {
const setting = await SettingsHelper.GetSetting(`role.${requiredRoles[i]}`, message.guild?.id); if (message.guild) {
const setting = await SettingsHelper.GetSetting(`role.${requiredRoles[i]}`, message.guild?.id);
if (!setting) { if (!setting) {
message.reply("Unable to verify if you have this role, please contact your bot administrator"); message.reply("Unable to verify if you have this role, please contact your bot administrator");
return; return;
} }
if (!message.member.roles.cache.find(role => role.name == setting)) { if (!message.member.roles.cache.find(role => role.name == setting)) {
message.reply(`You require the \`${StringTools.Capitalise(setting)}\` role to run this command`); message.reply(`You require the \`${StringTools.Capitalise(setting)}\` role to run this command`);
return; return;
}
} }
} }
} }