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) {
|
||||
const roleNamesWeCannotAssign = rolesWeCannotAssign.map(
|
||||
roleId => pluginData.guild.roles.cache.get(roleId)?.name || roleId,
|
||||
);
|
||||
if (rolesWeCannotAssign.length || rolesWeCannotRemove.length) {
|
||||
const mapFn = (roleId: Snowflake) => pluginData.guild.roles.cache.get(roleId)?.name || roleId;
|
||||
const roleNamesWeCannotAssign = rolesWeCannotAssign.map(mapFn);
|
||||
const roleNamesWeCannotRemove = rolesWeCannotRemove.map(mapFn);
|
||||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
logs.logBotAlert({
|
||||
body: `Unable to assign the following roles in Automod rule **${ruleName}**: **${roleNamesWeCannotAssign.join(
|
||||
"**, **",
|
||||
)}**`,
|
||||
});
|
||||
}
|
||||
|
||||
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(
|
||||
"**, **",
|
||||
)}**`,
|
||||
});
|
||||
let body = `Unable to change roles in Automod rule **${ruleName}**:`;
|
||||
if (roleNamesWeCannotAssign.length) body += `\n**Add:** ${roleNamesWeCannotAssign.join("**, **")}}`;
|
||||
if (roleNamesWeCannotRemove.length) body += `\n**Remove:** ${roleNamesWeCannotRemove.join("**, **")}}`;
|
||||
logs.logBotAlert({ body });
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue