![](/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.