commandDispatcher: add support for sending a reaction instead of a message

This commit is contained in:
Cynthia Foxwell 2021-05-27 16:45:56 -06:00
parent 97206cb213
commit b176fe8184
1 changed files with 23 additions and 19 deletions

View File

@ -88,32 +88,36 @@ async function CommandDispatcher(msg) {
file = response.file; file = response.file;
delete response.file; delete response.file;
} }
msg.channel if (response.reaction) {
.createMessage( msg.addReaction(response.reaction);
Object.assign( } else {
typeof response === "string" ? {content: response} : response, msg.channel
{ .createMessage(
Object.assign(
typeof response === "string" ? {content: response} : response,
{
allowedMentions: {
repliedUser: false,
},
messageReference: {
messageID: msg.id,
},
}
),
file
)
.catch((e) => {
msg.channel.createMessage({
content: `:warning: An error has occurred:\n\`\`\`${e}\`\`\``,
allowedMentions: { allowedMentions: {
repliedUser: false, repliedUser: false,
}, },
messageReference: { messageReference: {
messageID: msg.id, messageID: msg.id,
}, },
} });
),
file
)
.catch((e) => {
msg.channel.createMessage({
content: `:warning: An error has occurred:\n\`\`\`${e}\`\`\``,
allowedMentions: {
repliedUser: false,
},
messageReference: {
messageID: msg.id,
},
}); });
}); }
} }
msg.hasRan = true; msg.hasRan = true;
} }