function processCommand(receivedMessage) {
          let fullCommand = receivedMessage.content.substr(1) // Remove the leading exclamation mark
          let splitCommand = fullCommand.split(" ") // Split the message up in to pieces for each space
          let primaryCommand = splitCommand[0] // The first word directly after the exclamation is the command
          let arguments = splitCommand.slice(1) // All other words are arguments/parameters/options for the command
          console.log("Command received: " + primaryCommand)
          console.log("Arguments: " + arguments) // There may not be any arguments
          if (primaryCommand == "<Enter Command 1>") { //Enter Command 1
            <Enter Command 1>Command(arguments, receivedMessage)
          } else if (primaryCommand == "<Enter Command 2>") { //Enter Command 2
              <Enter Command 2>(arguments, receivedMessage)}
          else if (primaryCommand == "<Enter Command 2>") {  //Enter Command 3
                  <Enter Command 2>(arguments, receivedMessage)
          } 
          else {
              receivedMessage.channel.send("I don't understand the command. Try Something else")//enter your error message
          }
      }
      
      Javascript language logo

      Process Command function

      Discord Js Cookbook

      Shortcut: discord.processcommand

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.