slowmode: fix bot slowmodes not being applied for slowmodes over 6h; add -mode option; add eager permission checks
This commit is contained in:
parent
805e275f5b
commit
bb823b6274
12 changed files with 227 additions and 110 deletions
|
@ -2,6 +2,9 @@ import { Message } from "eris";
|
|||
import { sendErrorMessage, sendSuccessMessage } from "src/pluginUtils";
|
||||
import { disableBotSlowmodeForChannel } from "./disableBotSlowmodeForChannel";
|
||||
import { noop } from "src/utils";
|
||||
import { getMissingChannelPermissions } from "../../../utils/getMissingChannelPermissions";
|
||||
import { BOT_SLOWMODE_DISABLE_PERMISSIONS } from "../requiredPermissions";
|
||||
import { missingPermissionError } from "../../../utils/missingPermissionError";
|
||||
|
||||
export async function actualDisableSlowmodeCmd(msg: Message, args, pluginData) {
|
||||
const botSlowmode = await pluginData.state.slowmodes.getChannelSlowmode(args.channel.id);
|
||||
|
@ -12,6 +15,17 @@ export async function actualDisableSlowmodeCmd(msg: Message, args, pluginData) {
|
|||
return;
|
||||
}
|
||||
|
||||
const me = pluginData.guild.members.get(pluginData.client.user.id);
|
||||
const missingPermissions = getMissingChannelPermissions(me, args.channel, BOT_SLOWMODE_DISABLE_PERMISSIONS);
|
||||
if (missingPermissions) {
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
msg.channel,
|
||||
`Unable to disable slowmode. ${missingPermissionError(missingPermissions)}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const initMsg = await msg.channel.createMessage("Disabling slowmode...");
|
||||
|
||||
// Disable bot-maintained slowmode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue