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

Improve companion channel error handling

This commit is contained in:
Dragory 2021-08-18 23:02:56 +03:00
parent 929716a958
commit ad800e335c
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -68,13 +68,24 @@ export async function handleCompanionPermissions(
});
}
} catch (e) {
if (isDiscordAPIError(e) && e.code === 50001) {
if (isDiscordAPIError(e)) {
const logs = pluginData.getPlugin(LogsPlugin);
logs.logBotAlert({
body: `Missing permissions to handle companion channels. Pausing companion channels for 5 minutes or until the bot is reloaded on this server.`,
});
pluginData.state.errorCooldownManager.setCooldown(ERROR_COOLDOWN_KEY, ERROR_COOLDOWN);
return;
if (e.code === 50001) {
logs.logBotAlert({
body: `One of the companion channels can't be accessed. Pausing companion channels for 5 minutes or until the bot is reloaded on this server.`,
});
pluginData.state.errorCooldownManager.setCooldown(ERROR_COOLDOWN_KEY, ERROR_COOLDOWN);
return;
}
if (e.code === 50013) {
logs.logBotAlert({
body: `Missing permissions to handle companion channels. Pausing companion channels for 5 minutes or until the bot is reloaded on this server.`,
});
pluginData.state.errorCooldownManager.setCooldown(ERROR_COOLDOWN_KEY, ERROR_COOLDOWN);
return;
}
}
throw e;