Better errors for reaction roles

This commit is contained in:
Dragory 2020-08-28 01:30:25 +03:00
parent fca8a8dcce
commit b53acd6b84
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 57 additions and 17 deletions

View file

@ -102,9 +102,19 @@ export const InitReactionRolesCmd = reactionRolesCmd({
// Apply the reactions themselves
const reactionRoles = await pluginData.state.reactionRoles.getForMessage(targetMessage.id);
await applyReactionRoleReactionsToMessage(pluginData, targetMessage.channel.id, targetMessage.id, reactionRoles);
const errors = await applyReactionRoleReactionsToMessage(
pluginData,
targetMessage.channel.id,
targetMessage.id,
reactionRoles,
);
if (errors.length) {
sendErrorMessage(pluginData, msg.channel, `Errors while adding reaction roles:\n${errors.join("\n")}`);
} else {
sendSuccessMessage(pluginData, msg.channel, "Reaction roles added");
}
sendSuccessMessage(pluginData, msg.channel, "Reaction roles added");
(await progressMessage).delete().catch(noop);
},
});