commandDispatcher: add support for sending a reaction instead of a message
This commit is contained in:
parent
97206cb213
commit
b176fe8184
1 changed files with 23 additions and 19 deletions
|
@ -88,32 +88,36 @@ async function CommandDispatcher(msg) {
|
|||
file = response.file;
|
||||
delete response.file;
|
||||
}
|
||||
msg.channel
|
||||
.createMessage(
|
||||
Object.assign(
|
||||
typeof response === "string" ? {content: response} : response,
|
||||
{
|
||||
if (response.reaction) {
|
||||
msg.addReaction(response.reaction);
|
||||
} else {
|
||||
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: {
|
||||
repliedUser: false,
|
||||
},
|
||||
messageReference: {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue