3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-14 13:57:19 +00:00

Resolve issues mentioned in #139 comments

This commit is contained in:
Dark 2021-01-16 18:48:00 +01:00
parent 37cdb2e66b
commit c11218d68f
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
4 changed files with 9 additions and 6 deletions

View file

@ -177,4 +177,8 @@ export const ModActionsPlugin = zeppelinGuildPlugin<ModActionsPluginType>()("mod
outdatedTempbansLoop(pluginData);
},
onUnload(pluginData) {
pluginData.state.unloaded = true;
},
});

View file

@ -1,7 +1,7 @@
import { modActionsCmd, IgnoredEventType } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { canActOn, sendErrorMessage, hasPermission, sendSuccessMessage } from "../../../pluginUtils";
import { resolveUser, resolveMember, stripObjectToScalars } from "../../../utils";
import { resolveUser, resolveMember, stripObjectToScalars, noop } from "../../../utils";
import { isBanned } from "../functions/isBanned";
import { readContactMethodsFromArgs } from "../functions/readContactMethodsFromArgs";
import { formatReasonWithAttachments } from "../functions/formatReasonWithAttachments";
@ -46,7 +46,6 @@ export const BanCmd = modActionsCmd({
return sendErrorMessage(pluginData, msg.channel, `User not found`);
}
const time = args["time"] ? args["time"] : null;
console.log(time);
const reason = formatReasonWithAttachments(args.reason, msg.attachments);
const memberToBan = await resolveMember(pluginData.client, pluginData.guild, user.id);
@ -78,7 +77,7 @@ export const BanCmd = modActionsCmd({
const alreadyBannedMsg = await msg.channel.createMessage("User is already banned, update ban?");
const reply = await waitForReaction(pluginData.client, alreadyBannedMsg, ["✅", "❌"], msg.author.id);
alreadyBannedMsg.delete();
alreadyBannedMsg.delete().catch(noop);
if (!reply || reply.name === "❌") {
sendErrorMessage(pluginData, msg.channel, "User already banned, update cancelled by moderator");
lock.unlock();
@ -126,7 +125,7 @@ export const BanCmd = modActionsCmd({
const notOnServerMsg = await msg.channel.createMessage("User not found on the server, forceban instead?");
const reply = await waitForReaction(pluginData.client, notOnServerMsg, ["✅", "❌"], msg.author.id);
notOnServerMsg.delete();
notOnServerMsg.delete().catch(noop);
if (!reply || reply.name === "❌") {
sendErrorMessage(pluginData, msg.channel, "User not on server, ban cancelled by moderator");
lock.unlock();

View file

@ -104,7 +104,7 @@ export async function banUserId(
const noteDetails: string[] = [];
const timeUntilUnban = banTime ? humanizeDuration(banTime) : "indefinite";
const timeDetails = `Banned ${banTime ? `for ${timeUntilUnban}` : "indefinitely"}`;
if (notifyResult.text) noteDetails.push(notifyResult.text);
if (notifyResult.text) noteDetails.push(ucfirst(notifyResult.text));
noteDetails.push(timeDetails);
const createdCase = await casesPlugin.createCase({