fix commands with perm checks being ran by bots

This commit is contained in:
Cynthia Foxwell 2024-05-10 13:57:06 -06:00
parent 5c7abc26aa
commit 542070b33b
3 changed files with 8 additions and 0 deletions

View file

@ -183,6 +183,7 @@ settings.callback = async function (msg, line, [cmd, key, value]) {
!hf.config.elevated.includes(msg.author.id) !hf.config.elevated.includes(msg.author.id)
) )
return "You do not have `Manage Server` permissions"; return "You do not have `Manage Server` permissions";
if (msg.author.bot) return "Zero-width space your say command.";
if (!guildSettings.flags[key]) return "Unknown key."; if (!guildSettings.flags[key]) return "Unknown key.";
@ -198,6 +199,7 @@ settings.callback = async function (msg, line, [cmd, key, value]) {
!hf.config.elevated.includes(msg.author.id) !hf.config.elevated.includes(msg.author.id)
) )
return "You do not have `Manage Server` permissions"; return "You do not have `Manage Server` permissions";
if (msg.author.bot) return "Zero-width space your say command.";
if (!guildSettings.flags[key]) return "Unknown key."; if (!guildSettings.flags[key]) return "Unknown key.";

View file

@ -26,6 +26,7 @@ tidy.callback = async function (msg, line, [subcommand, count, extra]) {
) { ) {
return "I do not have `Manage Messages` permission."; return "I do not have `Manage Messages` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
switch (subcommand) { switch (subcommand) {
case "all": { case "all": {

View file

@ -103,6 +103,7 @@ roleme.callback = async function (msg, line, args) {
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) { if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) {
return "I do not have `Manage Roles` permission."; return "I do not have `Manage Roles` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
const role = await lookupRole(msg, argStr); const role = await lookupRole(msg, argStr);
if (role === "No results") return role; if (role === "No results") return role;
@ -124,6 +125,7 @@ roleme.callback = async function (msg, line, args) {
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) { if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) {
return "I do not have `Manage Roles` permission."; return "I do not have `Manage Roles` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
const roles = await getRoles(msg.guildID); const roles = await getRoles(msg.guildID);
@ -163,6 +165,7 @@ roleme.callback = async function (msg, line, args) {
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) { if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) {
return "I do not have `Manage Roles` permission."; return "I do not have `Manage Roles` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
const roles = await getRoles(msg.guildID); const roles = await getRoles(msg.guildID);
@ -184,6 +187,7 @@ roleme.callback = async function (msg, line, args) {
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) { if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) {
return "I do not have `Manage Roles` permission."; return "I do not have `Manage Roles` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
const roles = await getRoles(msg.guildID); const roles = await getRoles(msg.guildID);
@ -217,6 +221,7 @@ roleme.callback = async function (msg, line, args) {
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) { if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageRoles")) {
return "I do not have `Manage Roles` permission."; return "I do not have `Manage Roles` permission.";
} }
if (msg.author.bot) return "Zero-width space your say command.";
const roles = await getRoles(msg.guildID); const roles = await getRoles(msg.guildID);