简体   繁体   English

如何在Slack中使用Hubot

[英]How to use Hubot in Slack

This seems like a stupid question. 这似乎是一个愚蠢的问题。

I have deployed Hubot to Heroku and set the configs given from Slack per this instruction . 我已经将Hubot部署到Heroku并根据Slack设置了这条指令给出的配置。 However I don't know if Hubot should show up as a member in my team or not. 但是我不知道Hubot是否应该出现在我的团队中。 I can post a message via REST and the log says that a message is received. 我可以通过REST发布消息,日志显示收到消息。

Should Hubot become a member in a team that I can send direct message to or there is something I am missing? 如果Hubot成为团队中的成员,我可以直接发送消息或者我遗漏了什么?

Hubot doesn't appear as a team member in Slack, but it will still be sitting in your channels and dutifully listening (if you've properly set everything up). Hubot并不是Slack中的团队成员,但它仍然会坐在您的频道中并尽职尽责地倾听(如果您已正确设置了所有内容)。 Just directly call it by whatever name you gave it, and it should respond. 只需用你给它的名字直接调用它,它就应该响应。 So if you set: 所以,如果你设置:

HUBOT_SLACK_BOTNAME=hubot

...in Heroku, then hop into the #general channel in Slack and ping Hubot: ...在Heroku中,然后#general Slack中的#general通道并ping Hubot:

hubot help hubot帮助

The hubot slack integration seems to be somewhat lacking. hubot整合似乎有点缺乏。 If you want Hubot to look like an actual member, you can use the hubot-irc adapter and connect to your slack instance using the irc gateway. 如果您希望Hubot看起来像一个实际成员,您可以使用hubot-irc适配器并使用irc网关连接到您的slack实例。 Make sure you have IRC enabled for your slack instance 确保为松弛实例启用了IRC

  1. Create a "user" account for Hubot 为Hubot创建一个“用户”帐户
  2. Login to your slack instance as your hubot user 以hubot用户身份登录您的slack实例
  3. Goto https://yourdomain.slack.com/account/gateways 转到https://yourdomain.slack.com/account/gateways
  4. Use the irc connection info in the Hubot specific variables for hubot-irc 在hubot-irc的Hubot特定变量中使用irc连接信息
  5. Fire up hubot and watch it connect 启动hubot并观察它是否连接

Just an example of the ./bin/slackbot file I use to load up hubot. 只是我用来加载hubot的./bin/slackbot文件的一个例子。 I don't use mine on heroku but I imagine the variable setup should be similar. 我没有在heroku上使用我的,但我想变量设置应该是相似的。

# Make this file executable and run from your hubot directory

HUBOT_IRC_SERVER="yourdomain.irc.slack.com" \
HUBOT_IRC_ROOMS="#general,#random" \
HUBOT_IRC_NICK="slackbot" \
HUBOT_IRC_PASSWORD="yourdomain.1239586t437389" \
HUBOT_IRC_NICKSERV_PASSWORD="yourdomain.129319823719" \
HUBOT_IRC_UNFLOOD="false" \
HUBOT_IRC_USESSL=1
bin/hubot -a irc --name hitbot

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM