From 48d7eb97e31f5f0d65faf7bf84f2c7b704386bf7 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sun, 24 Jul 2022 18:21:56 +0300 Subject: [PATCH] fix invalid chatlogs webhook --- src/structure/client/wrappers/GuildWrapper.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/structure/client/wrappers/GuildWrapper.js b/src/structure/client/wrappers/GuildWrapper.js index 6adc998..2c15a71 100644 --- a/src/structure/client/wrappers/GuildWrapper.js +++ b/src/structure/client/wrappers/GuildWrapper.js @@ -241,8 +241,13 @@ class GuildWrapper { if (!result) return null; if (!this.me.permissions.has('ManageWebhooks')) throw new Error('Missing ManageWebhooks'); const hooks = await this.fetchWebhooks(); - const hook = hooks.get(result.hookID); + let hook = hooks.get(result.hookID); if (!hook) return null; + if (!hook.token) { // Happens when the webhook from imported settings is used, replace it. + const channel = await this.resolveChannel(hook.channelId); + await hook.delete('Old hook'); + hook = await channel.createWebhook({ name: 'Galactic Bot message logs' }); + } // const hook = new WebhookClient(result.hookID, result.token, { // disableMentions: 'everyone' // });