Skip to content

How to send message in function catchALL? #1597

Answered by Nothingtoloose
ardani asked this question in Q&A
Discussion options

You must be logged in to vote

Here is a simple example. The example has the goal that Hubot always responds when he does not recognize a command.

module.exports = (robot) ->
  robot.catchAll (msg) ->
    match = /^\@Hubot+/i.test(msg.message.text) or /^\Hubot+/i.test(msg.message.text)
    if match 
      msg.send "Der Befehl '#{msg.message.text}' wurde nicht erkannt. \nBitte geben Sie '@hubot Hilfe' ein, um sich alle Befehle angezeigen zu lassen."

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by technicalpickles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1394 on April 18, 2023 14:07.