3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

fix(slowmode): fix error if channel.permissionOverwrites doesn't exist

This commit is contained in:
Dragory 2021-10-17 21:01:55 +03:00
parent d27f6f94df
commit 0de271994f
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -19,7 +19,7 @@ export async function applyBotSlowmodeToUserId(
if (existingOverride) {
await existingOverride.edit({ SEND_MESSAGES: false });
} else {
await channel.permissionOverwrites.create(userId as Snowflake, { SEND_MESSAGES: false }, { type: 1 });
await channel.permissionOverwrites?.create(userId as Snowflake, { SEND_MESSAGES: false }, { type: 1 });
}
} catch (e) {
const user = await pluginData.client.users.fetch(userId as Snowflake).catch(() => new UnknownUser({ id: userId }));