phone
, and we will give it two sub commands, text
and call
, so when we use them, they will be as follows:/phone text
/phone call
slashcommands
directory at the root of the project and add a file named PhoneCommand.ts
. Then add the following code:phone
.text
is match, log "Texting!"call
is match, log "Calling!"/phone text
and the app will print "Texting!" to the console, or you can type /phone call
and the app will print "Calling!" to the console.If you don't see the result, enable info logs in your instance at Administration > Logs > Log Level by selecting "1 - Errors and Information".
PhoneCommand.ts
, add the following private method:console.log
s from the switch block of the executor
method and call the sendMessage
method instead:context
and modify
are the arguments passed to the executor
method and they will be passed over to the sendMessage
method./phone text
or /phone call
, you'll receive the response in the chat, as your user.