hubot + Slack + coffeescriptでオウム返し
hubot + Slack + coffeescriptでオウム返し
環境
- hubot
- Slack
- slackbot
- CoffeeScript
- vps
- sakura
- forever
- デーモン
階層
# pwd
/scripts
# ls
test.coffee
実装
robot.hear /(.*)$/i, (msg) ->
text = msg.message.text
msg.send "#{text} "
説明
/(.*)$/iで正規表現で送信したメッセージをそのまま受け取ることができる。
(msg)に受け取ったメッセージが入っている。
msg.message.textでメッセージを受け取ることができる。
coffeescriptは変数宣言のvarなどがいらない。
msg.send “#{text} “で受け取ったメッセージをそのままオウム返し
[itemlink post_id=”9746″]
[itemlink post_id=”9957”]