3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

More fixes, change rest of stripObjectToScalars to configAccessibleObj

This commit is contained in:
Dark 2021-07-21 22:14:09 +02:00
parent 4ad99975de
commit acb4913495
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
66 changed files with 623 additions and 192 deletions

View file

@ -1,6 +1,7 @@
import { Snowflake, TextChannel } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { performance } from "perf_hooks";
import { userToConfigAccessibleUser } from "src/utils/configAccessibleObjects";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
import { LogType } from "../../../data/LogType";
@ -80,6 +81,7 @@ export const MassbanCmd = modActionsCmd({
const startTime = performance.now();
const failedBans: string[] = [];
const casesPlugin = pluginData.getPlugin(CasesPlugin);
const deleteDays = (await pluginData.config.getForMessage(msg)).ban_delete_message_days;
for (const [i, userId] of args.userIds.entries()) {
if (pluginData.state.unloaded) {
break;
@ -92,7 +94,7 @@ export const MassbanCmd = modActionsCmd({
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId, 120 * 1000);
await pluginData.guild.bans.create(userId as Snowflake, {
days: 1,
days: deleteDays,
reason: banReason != null ? encodeURIComponent(banReason) : undefined,
});
@ -128,7 +130,7 @@ export const MassbanCmd = modActionsCmd({
} else {
// Some or all bans were successful. Create a log entry for the mass ban and notify the user.
pluginData.state.serverLogs.log(LogType.MASSBAN, {
mod: stripObjectToScalars(msg.author),
mod: userToConfigAccessibleUser(msg.author),
count: successfulBanCount,
reason: banReason,
});