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:
parent
929716a958
commit
ad800e335c
1 changed files with 17 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue