hubot的插件使用

hubot是一个开源的聊天机器人框架,支持很多的插件。hubot的插件安装都是通过npm install来执行,安装完之后,通常需要在external-scripts.json里面追加新安装的插件名(有的插件不需要加,比如hubot-bearychat)。根据不同插件的需求,还需要设置相应的环境变量。

目前主要用的几个插件

0 hubot-slack
安装:npm install hubot-slack
环境变量:
HUBOT_SLACK_TOKEN

1 hubot-jenkins
安装:npm install hubot-jenkins
环境变量:
HUBOT_JENKINS_URL
HUBOT_JENKINS_AUTH
(Auth的格式为user:password)

2 hubot-grafana
安装:npm install hubot-grafana
环境变量:
HUBOT_GRAFANA_HOST
HUBOT_GRAFANA_API_KEY

3 hubot-script-shellcmd
安装:npm install hubot-script-shellcmd

4 hubot-bearychat
相当于国产版slack,中文名叫倍洽,用起来也还不错的。特别是国内安卓用户不能从Google Play下载Slack,BearyChat是不错的选择。
安装:npm install hubot-bearychat
环境变量:
export HUBOT_BEARYCHAT_TOKENS
export HUBOT_BEARYCHAT_MODE(支持rtm和http两种模式,默认是rtm模式)

补充:安装完插件之后,通常要在external-scripts.json添加相关插件信息,如:

[
  "hubot-diagnostics",
  "hubot-help",
  "hubot-google-images",
  "hubot-google-translate",
  "hubot-pugme",
  "hubot-maps",
  "hubot-rules",
  "hubot-shipit",
  "hubot-grafana",
  "hubot-script-shellcmd",
  "hubot-jenkins"
]
可能遇到的报错

启动hubot的时候,可能会报如下提示信息:
eg.1
Your hubot-scripts.json is empty, so you just need to remove it.
解决:将为空的hubot-scripts.json文件删除

eg.2
bash/handler not found in hubot working dir..defaulting to example handler at /opt/myhubot/node_modules/hubot-script-shellcmd/src/../bash/handler
解决:在hubot的工作空间下,如果没有bash/handler将会到node_modules/hubot-script-shellcmd模块目录下去找。
为了方便,可以把hubot-script-shellcmd模块下的bash/handler拷贝到hobot目录下,以后添加脚本直接添加到该bash/handlers/目录下即可(添加脚本需要重启hubot生效)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值