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;
 | 
					        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;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue