3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-21 16:55:03 +00:00

Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 293a850075
commit c99e745f89
177 changed files with 854 additions and 707 deletions

View file

@ -1,6 +1,7 @@
import { mutesCmd } from "../types";
import { sendSuccessMessage } from "../../../pluginUtils";
import { User } from "discord.js";
export const ClearBannedMutesCmd = mutesCmd({
trigger: "clear_banned_mutes",
@ -8,17 +9,14 @@ export const ClearBannedMutesCmd = mutesCmd({
description: "Clear dangling mutes for members who have been banned",
async run({ pluginData, message: msg }) {
await msg.channel.createMessage("Clearing mutes from banned users...");
await msg.channel.send("Clearing mutes from banned users...");
const activeMutes = await pluginData.state.mutes.getActiveMutes();
// Mismatch in Eris docs and actual result here, based on Eris's code comments anyway
const bans: Array<{ reason: string; user: User }> = (await pluginData.guild.getBans()) as any;
const bans: Array<{ reason: string; user: User }> = (await pluginData.guild.bans.fetch({ cache: true })) as any;
const bannedIds = bans.map(b => b.user.id);
await msg.channel.createMessage(
`Found ${activeMutes.length} mutes and ${bannedIds.length} bans, cross-referencing...`,
);
await msg.channel.send(`Found ${activeMutes.length} mutes and ${bannedIds.length} bans, cross-referencing...`);
let cleared = 0;
for (const mute of activeMutes) {