![](/img/trans.png)
[英]Unable to send a message to specific channel in Slack with Hubot - SlackRTMError: no channel id
[英]Hubot script only works in Slack when I directly message the robot
目前,我的Hubot机器人在技术上处于工作状态。 如果我直接将此消息发送给Slack中的机器人:
qbot !npm bower
它将通过以下链接进行回复:
https://www.npmjs.com/package/bower
如果我只是这样做也可以:
!npm bower
但是,如果我在常规频道中说了这些消息中的任何一个,则机器人不会执行任何操作。 任何帮助,将不胜感激! 这是脚本,如果有帮助的话:
# Description:
# Get a link to an npm module
#
# Dependencies:
# request
#
# Configuration:
# None
#
# Commands:
# qbot !npm <module>
request = require "request"
module.exports = (robot) ->
robot.hear /\!npm (.*)/i, (res) ->
module = res.match[1]
query = "https://www.npmjs.com/package/#{module}"
request query, (error, response, body) ->
unless error or response.statusCode is 404
res.send query
自从我自己做以来已经有很长时间了,但是我相信您想从想要使用它的频道中按名称来/invite
您的hubot。请参阅此处的文档: https : //github.com/slackhq/ hubot-松弛#配置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.