fix invalid chatlogs webhook
This commit is contained in:
parent
a77ee0f3d4
commit
48d7eb97e3
@ -241,8 +241,13 @@ class GuildWrapper {
|
|||||||
if (!result) return null;
|
if (!result) return null;
|
||||||
if (!this.me.permissions.has('ManageWebhooks')) throw new Error('Missing ManageWebhooks');
|
if (!this.me.permissions.has('ManageWebhooks')) throw new Error('Missing ManageWebhooks');
|
||||||
const hooks = await this.fetchWebhooks();
|
const hooks = await this.fetchWebhooks();
|
||||||
const hook = hooks.get(result.hookID);
|
let hook = hooks.get(result.hookID);
|
||||||
if (!hook) return null;
|
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, {
|
// const hook = new WebhookClient(result.hookID, result.token, {
|
||||||
// disableMentions: 'everyone'
|
// disableMentions: 'everyone'
|
||||||
// });
|
// });
|
||||||
|
Loading…
Reference in New Issue
Block a user