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

fix: log all errors when attempting to create a webhook and gracefully return

This commit is contained in:
Dragory 2021-11-02 21:00:23 +02:00
parent 0064d8fe3e
commit a7d71e0762
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -35,12 +35,13 @@ export async function getOrCreateWebhookForChannel(
});
return [webhook.id, webhook.token!];
} catch (err) {
console.warn(`Error when trying to create webhook for ${pluginData.guild.id}/${channel.id}: ${err.message}`);
if (isDiscordAPIError(err) && err.code === 50013) {
pluginData.state.missingPermissions = true;
console.warn(`Error ${err.code} when trying to create webhook for ${pluginData.guild.id}`);
return null;
}
throw err;
return null;
}
}