3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-14 05:57:18 +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); outdatedTempbansLoop(pluginData);
}, },
onUnload(pluginData) {
pluginData.state.unloaded = true;
},
}); });

View file

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

View file

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

View file

@ -6,7 +6,7 @@
"scripts": { "scripts": {
"build": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.js", "build": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.js",
"build-debug": "rimraf dist && cross-env NODE_ENV=development webpack --config webpack.config.js", "build-debug": "rimraf dist && cross-env NODE_ENV=development webpack --config webpack.config.js",
"watch": "cross-env NODE_ENV=development webpack-dev-server --disable-host-check", "watch": "cross-env NODE_ENV=development webpack-dev-server",
"watch-build": "rimraf dist && NODE_ENV=development webpack --config webpack.config.js --watch" "watch-build": "rimraf dist && NODE_ENV=development webpack --config webpack.config.js --watch"
}, },
"devDependencies": { "devDependencies": {