I am trying to use the node.js discord module to make a bot that will send a private message to a user when a command is entered in discord. The command is supposed to be used like
!rp <@recipient>
and the message is delivered to the recipient.
My code is:
else if (rhysmessage.substring(0,4) == ("!rp ")) {
e.message.delete();
var end
var charactercheck
for (end=0; charactercheck < rhysmessage.length; charactercheck = 
charactercheck + 1) {
  console.log(rhysmessage.charAt(charactercheck))
  if (rhysmessage.charAt(charactercheck) == " ") {
    end = charactercheck}
}
if (end == 0){
  rhyschannel.sendMessage("Please use format `!rp <recipient> 
<message>`")
}
else {
  usersendto = rhysmessage.substring(5,end-1)   
usersendto.sendMessage(rhysmessage.substring(end+1,rhysmessage.leng
th)
    }
   }
When I run this code, I get the error: "UnhandledPromiseRejectionWarning". Why is this?
 
    