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

Type fixes for djs

This commit is contained in:
Dark 2021-06-30 04:56:56 +02:00
parent 653d6c1dc2
commit 0822fc15e5
No known key found for this signature in database
GPG key ID: 2CD6ACB6B0A87B8A
130 changed files with 8877 additions and 411 deletions

View file

@ -1,4 +1,4 @@
import { GuildChannel, Permissions, TextChannel } from "discord.js";
import { GuildChannel, Permissions, Snowflake, TextChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { LogType } from "../../../data/LogType";
import { logger } from "../../../logger";
@ -11,7 +11,7 @@ export async function applyBotSlowmodeToUserId(
userId: string,
) {
// Deny sendMessage permission from the user. If there are existing permission overwrites, take those into account.
const existingOverride = channel.permissionOverwrites.get(userId);
const existingOverride = channel.permissionOverwrites.get(userId as Snowflake);
const newDeniedPermissions =
(existingOverride ? existingOverride.deny.bitfield : 0n) | Permissions.FLAGS.SEND_MESSAGES;
const newAllowedPermissions =
@ -22,7 +22,7 @@ export async function applyBotSlowmodeToUserId(
{ id: userId, allow: newAllowedPermissions, deny: newDeniedPermissions, type: "member" },
]);
} catch (e) {
const user = pluginData.client.users.fetch(userId) || new UnknownUser({ id: userId });
const user = pluginData.client.users.fetch(userId as Snowflake) || new UnknownUser({ id: userId });
if (isDiscordRESTError(e) && e.code === 50013) {
logger.warn(