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

Upgrade DJS, fix bugs

This commit is contained in:
Dark 2021-06-30 18:43:42 +02:00
parent 0822fc15e5
commit be71357ff9
No known key found for this signature in database
GPG key ID: 384C4B4F5B1E25A8
17 changed files with 123 additions and 66 deletions

View file

@ -1,4 +1,4 @@
import { TextChannel } from "discord.js";
import { Snowflake, TextChannel } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { performance } from "perf_hooks";
import { commandTypeHelpers as ct } from "../../../commandTypes";
@ -42,7 +42,7 @@ export const MassbanCmd = modActionsCmd({
// Verify we can act on each of the users specified
for (const userId of args.userIds) {
const member = pluginData.guild.members.cache.get(userId); // TODO: Get members on demand?
const member = pluginData.guild.members.cache.get(userId as Snowflake); // TODO: Get members on demand?
if (member && !canActOn(pluginData, msg.member, member)) {
sendErrorMessage(pluginData, msg.channel, "Cannot massban one or more users: insufficient permissions");
return;
@ -91,7 +91,7 @@ export const MassbanCmd = modActionsCmd({
ignoreEvent(pluginData, IgnoredEventType.Ban, userId, 120 * 1000);
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, userId, 120 * 1000);
await pluginData.guild.bans.create(userId, {
await pluginData.guild.bans.create(userId as Snowflake, {
days: 1,
reason: banReason != null ? encodeURIComponent(banReason) : undefined,
});

View file

@ -1,4 +1,4 @@
import { TextChannel } from "discord.js";
import { Snowflake, TextChannel } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { CaseTypes } from "../../../data/CaseTypes";
@ -60,7 +60,10 @@ export const MassunbanCmd = modActionsCmd({
}
try {
await pluginData.guild.bans.remove(userId, unbanReason != null ? encodeURIComponent(unbanReason) : undefined);
await pluginData.guild.bans.remove(
userId as Snowflake,
unbanReason != null ? encodeURIComponent(unbanReason) : undefined,
);
await casesPlugin.createCase({
userId,

View file

@ -1,4 +1,4 @@
import { TextChannel } from "discord.js";
import { Snowflake, TextChannel } from "discord.js";
import { waitForReply } from "knub/dist/helpers";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { LogType } from "../../../data/LogType";
@ -43,7 +43,7 @@ export const MassmuteCmd = modActionsCmd({
// Verify we can act upon all users
for (const userId of args.userIds) {
const member = pluginData.guild.members.cache.get(userId);
const member = pluginData.guild.members.cache.get(userId as Snowflake);
if (member && !canActOn(pluginData, msg.member, member)) {
sendErrorMessage(pluginData, msg.channel, "Cannot massmute one or more users: insufficient permissions");
return;