diff --git a/src/plugins/Slowmode.ts b/src/plugins/Slowmode.ts index 996731e4..f8225db6 100644 --- a/src/plugins/Slowmode.ts +++ b/src/plugins/Slowmode.ts @@ -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", " ") + @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 */