moderation.tidy: fix breaking in DMs, allow help to always be shown
This commit is contained in:
parent
84529b86af
commit
a3e092c78d
1 changed files with 13 additions and 2 deletions
|
@ -10,10 +10,20 @@ tidy.category = CATEGORY;
|
||||||
tidy.helpText = "Clean up messages";
|
tidy.helpText = "Clean up messages";
|
||||||
tidy.usage = "[subcommand] <count> <extra>";
|
tidy.usage = "[subcommand] <count> <extra>";
|
||||||
tidy.callback = async function (msg, line, [subcommand, count, extra]) {
|
tidy.callback = async function (msg, line, [subcommand, count, extra]) {
|
||||||
if (!msg.channel.permissionsOf(msg.author.id).has("manageMessages")) {
|
const showHelp = !subcommand || subcommand === "" || subcommand === "help";
|
||||||
|
if (!showHelp && !msg.guildID) {
|
||||||
|
return "Can only be used in guilds.";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!showHelp &&
|
||||||
|
!msg.channel.permissionsOf(msg.author.id).has("manageMessages")
|
||||||
|
) {
|
||||||
return "You do not have `Manage Messages` permission.";
|
return "You do not have `Manage Messages` permission.";
|
||||||
}
|
}
|
||||||
if (!msg.channel.permissionsOf(hf.bot.user.id).has("manageMessages")) {
|
if (
|
||||||
|
!showHelp &&
|
||||||
|
!msg.channel.permissionsOf(hf.bot.user.id).has("manageMessages")
|
||||||
|
) {
|
||||||
return "I do not have `Manage Messages` permission.";
|
return "I do not have `Manage Messages` permission.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +98,7 @@ tidy.callback = async function (msg, line, [subcommand, count, extra]) {
|
||||||
|
|
||||||
return `Deleted ${messages.length} message(s).`;
|
return `Deleted ${messages.length} message(s).`;
|
||||||
}
|
}
|
||||||
|
case "help":
|
||||||
default:
|
default:
|
||||||
return `__Usage__
|
return `__Usage__
|
||||||
• \`all <count = 10>\` - Last \`count\` messages.
|
• \`all <count = 10>\` - Last \`count\` messages.
|
||||||
|
|
Loading…
Reference in a new issue