mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add command to clear dangling active mutes
This commit is contained in:
parent
dcb00d74f8
commit
10d757f588
1 changed files with 14 additions and 1 deletions
|
@ -4,7 +4,7 @@ import moment from "moment-timezone";
|
||||||
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
||||||
import { GuildActions } from "../data/GuildActions";
|
import { GuildActions } from "../data/GuildActions";
|
||||||
import { GuildMutes } from "../data/GuildMutes";
|
import { GuildMutes } from "../data/GuildMutes";
|
||||||
import { DBDateFormat, chunkMessageLines, stripObjectToScalars, successMessage } from "../utils";
|
import { DBDateFormat, chunkMessageLines, stripObjectToScalars, successMessage, errorMessage } from "../utils";
|
||||||
import humanizeDuration from "humanize-duration";
|
import humanizeDuration from "humanize-duration";
|
||||||
import { LogType } from "../data/LogType";
|
import { LogType } from "../data/LogType";
|
||||||
import { GuildLogs } from "../data/GuildLogs";
|
import { GuildLogs } from "../data/GuildLogs";
|
||||||
|
@ -235,6 +235,19 @@ export class MutesPlugin extends ZeppelinPlugin {
|
||||||
msg.channel.createMessage(successMessage(`Cleared ${cleared} mutes from members that don't have the mute role`));
|
msg.channel.createMessage(successMessage(`Cleared ${cleared} mutes from members that don't have the mute role`));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@d.command("clear_mute", "<userId:string>")
|
||||||
|
@d.permission("cleanup")
|
||||||
|
async clearMuteCmd(msg: Message, args: { userId: string }) {
|
||||||
|
const mute = await this.mutes.findExistingMuteForUserId(args.userId);
|
||||||
|
if (!mute) {
|
||||||
|
msg.channel.createMessage(errorMessage("No active mutes found for that user id"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.mutes.clear(args.userId);
|
||||||
|
msg.channel.createMessage(successMessage(`Active mute cleared`));
|
||||||
|
}
|
||||||
|
|
||||||
protected async clearExpiredMutes() {
|
protected async clearExpiredMutes() {
|
||||||
const expiredMutes = await this.mutes.getExpiredMutes();
|
const expiredMutes = await this.mutes.getExpiredMutes();
|
||||||
for (const mute of expiredMutes) {
|
for (const mute of expiredMutes) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue