mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-23 09:35:02 +00:00
simplified bot alert logging
This commit is contained in:
parent
c975c672bc
commit
b845e4e34d
1 changed files with 8 additions and 21 deletions
|
@ -52,28 +52,15 @@ export const ChangeRolesAction = automodAction({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rolesWeCannotAssign.length) {
|
if (rolesWeCannotAssign.length || rolesWeCannotRemove.length) {
|
||||||
const roleNamesWeCannotAssign = rolesWeCannotAssign.map(
|
const mapFn = (roleId: Snowflake) => pluginData.guild.roles.cache.get(roleId)?.name || roleId;
|
||||||
roleId => pluginData.guild.roles.cache.get(roleId)?.name || roleId,
|
const roleNamesWeCannotAssign = rolesWeCannotAssign.map(mapFn);
|
||||||
);
|
const roleNamesWeCannotRemove = rolesWeCannotRemove.map(mapFn);
|
||||||
const logs = pluginData.getPlugin(LogsPlugin);
|
const logs = pluginData.getPlugin(LogsPlugin);
|
||||||
logs.logBotAlert({
|
let body = `Unable to change roles in Automod rule **${ruleName}**:`;
|
||||||
body: `Unable to assign the following roles in Automod rule **${ruleName}**: **${roleNamesWeCannotAssign.join(
|
if (roleNamesWeCannotAssign.length) body += `\n**Add:** ${roleNamesWeCannotAssign.join("**, **")}}`;
|
||||||
"**, **",
|
if (roleNamesWeCannotRemove.length) body += `\n**Remove:** ${roleNamesWeCannotRemove.join("**, **")}}`;
|
||||||
)}**`,
|
logs.logBotAlert({ body });
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rolesWeCannotRemove.length) {
|
|
||||||
const roleNamesWeCannotRemove = rolesWeCannotRemove.map(
|
|
||||||
roleId => pluginData.guild.roles.cache.get(roleId)?.name || roleId,
|
|
||||||
);
|
|
||||||
const logs = pluginData.getPlugin(LogsPlugin);
|
|
||||||
logs.logBotAlert({
|
|
||||||
body: `Unable to remove the following roles in Automod rule **${ruleName}**: **${roleNamesWeCannotRemove.join(
|
|
||||||
"**, **",
|
|
||||||
)}**`,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue