mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
slowmode: add !slowmode clear to clear slowmode from specific users
This commit is contained in:
parent
6e0e772d88
commit
ae158d6b48
1 changed files with 21 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
import { Plugin, decorators as d } from "knub";
|
||||
import { GuildChannel, Message, TextChannel, Constants as ErisConstants } from "eris";
|
||||
import { GuildChannel, Message, TextChannel, Constants as ErisConstants, User } from "eris";
|
||||
import { convertDelayStringToMS, errorMessage, noop, successMessage } from "../utils";
|
||||
import { GuildSlowmodes } from "../data/GuildSlowmodes";
|
||||
import humanizeDuration from "humanize-duration";
|
||||
|
@ -116,6 +116,26 @@ export class SlowmodePlugin extends Plugin {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* COMMAND: Clear slowmode from a specific user on a specific channel
|
||||
*/
|
||||
@d.command("slowmode clear", "<channel:channel> <user:user>")
|
||||
@d.permission("manage")
|
||||
async clearSlowmodeCmd(msg: Message, args: { channel: GuildChannel & TextChannel; user: User }) {
|
||||
const channelSlowmode = await this.slowmodes.getChannelSlowmode(args.channel.id);
|
||||
if (!channelSlowmode) {
|
||||
msg.channel.createMessage(errorMessage("Channel doesn't have slowmode!"));
|
||||
return;
|
||||
}
|
||||
|
||||
await this.removeSlowmodeFromUserId(args.channel, args.user.id);
|
||||
msg.channel.createMessage(
|
||||
successMessage(
|
||||
`Slowmode cleared from **${args.user.username}#${args.user.discriminator}** in <#${args.channel.id}>`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* COMMAND: Enable slowmode on the specified channel
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue