hubot shell 未加载脚本和包
hubot shell not loading scripts and packages
当我有一个适配器时 Hubot 工作,但是当我尝试使用 Shell 进行本地开发时 none 脚本或包被加载。
这个有效:
root@dev:~/hubot# bin/hubot forever start -w --watchDirectory ${PWD} --watchIgnore ${PWD}/*.log --pidfile ${PWD}/hubot.pid -l ${PWD}/hubot.log -a -c coffee node_modules/.bin/hubot --adapter slack
奇怪的是,当我尝试使用以下方法进行本地开发和测试时:
root@dev:~/hubot# bin/hubot
[Thu Apr 07 2016 00:33:10 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
eve>
eve> help
usage:
history
exit, \q - close shell and exit
help, \? - print this usage
clear, \c - clear the terminal screen
当我在 shell 中键入帮助时,我的 None 个脚本或模块会显示出来。但是当我在 slack 中执行此操作时,我会看到所有可用的脚本和模块:
eve <user> doesn't have <role> role - Removes a role from a user
eve <user> has <role> role - Assigns a role to a user
eve adapter - Reply with the adapter
eve delete reminder <action> - Delete reminder matching <action> (exact match required)
eve deploy <gitsha> to production - Runs Jenkins Phase 1 deployment.
eve echo <text> - Reply back with <text>
eve flip production pools - Flips the yin and yang production pools
eve help - Displays all of the help commands that Hubot knows about.
eve help <query> - Displays all help commands that match <query>.
eve list jobs - List current cron jobs
eve new job "<crontab format>" <message> - Schedule a cron job to say something
eve new job <crontab format> "<message>" - Ditto
eve new job <crontab format> say <message> - Ditto
eve ping - Reply with pong
** 更新 1:我打开了调试级别的日志记录,我可以看到正在解析脚本,但是在执行它们的命令时我无法使用这些脚本 :(**
[Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading adapter shell
eve> [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading scripts
from /root/hubot/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)]
DEBUG Parsing help for /root/hubot/scripts/example.coffee [Thu Apr 07
2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/scripts/prod_deploy.coffee [Thu Apr 07 2016 00:46:44
GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/scripts/remindme.coffee [Thu Apr 07 2016 00:46:44 GMT+0000
(UTC)] DEBUG Parsing help for /root/hubot/scripts/team_tools.coffee
[Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/scripts/update.coffee [Thu Apr 07 2016 00:46:44 GMT+0000
(UTC)] DEBUG Loading scripts from /root/hubot/src/scripts [Thu Apr 07
2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading hubot-scripts from
/root/hubot/node_modules/hubot-scripts/src/scripts [Thu Apr 07 2016
00:46:44 GMT+0000 (UTC)] DEBUG Loading external-scripts from npm
packages [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help
for /root/hubot/node_modules/hubot-diagnostics/src/diagnostics.coffee
[Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] INFO hubot-redis-brain:
Using default redis on localhost:6379 [Thu Apr 07 2016 00:46:45
GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/node_modules/hubot-redis-brain/src/redis-brain.coffee [Thu
Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/node_modules/hubot-auth/src/auth.coffee [Thu Apr 07 2016
00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/node_modules/hubot-help/src/help.coffee [Thu Apr 07 2016
00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for
/root/hubot/node_modules/hubot-cron/src/scripts/cron.coffee
更新 2:我意识到我的部分问题是在 bin/hubot 文件中明确将我的 bot 名称命名为 eve,而我一直在尝试使用 evedev,我的开发 hubot 名称.但是,我仍然想知道为什么 help 命令没有显示所有可用的命令,但是当我在 Slack 中时,它会显示。
您可以在bin/hubot
中查看您当前的机器人名称
看起来像exec node_modules/.bin/hubot --name "botname" "$@"
通过以上设置,机器人名称将是 botname
作为对 更新 2 的回答,您需要在键入 help
之前输入机器人的名称,如下所示:
myhubot> help
usage:
history
exit, \q - close shell and exit
help, \? - print this usage
clear, \c - clear the terminal screen
对
myhubot> myhubot help
myhubot> Shell: myhubot adapter - Reply with the adapter
myhubot animate me <query> - The same thing as `image me`, except adds a few parameters to try to return an animated GIF instead.
myhubot echo <text> - Reply back with <text>
myhubot help - Displays all of the help commands that Hubot knows about.
myhubot help <query> - Displays all help commands that match <query>.
myhubot image me <query> - The Original. Queries Google Images for <query> and returns a random top result.
myhubot map me <query> - Returns a map view of the area returned by `query`.
myhubot mustache me <url|query> - Adds a mustache to the specified URL or query result.
myhubot ping - Reply with pong
myhubot pug bomb N - get N pugs
myhubot pug me - Receive a pug
myhubot the rules - Make sure hubot still knows the rules.
myhubot time - Reply with current time
myhubot translate me <phrase> - Searches for a translation for the <phrase> and then prints that bad boy out.
myhubot translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional
ship it - Display a motivation squirrel
当我有一个适配器时 Hubot 工作,但是当我尝试使用 Shell 进行本地开发时 none 脚本或包被加载。
这个有效:
root@dev:~/hubot# bin/hubot forever start -w --watchDirectory ${PWD} --watchIgnore ${PWD}/*.log --pidfile ${PWD}/hubot.pid -l ${PWD}/hubot.log -a -c coffee node_modules/.bin/hubot --adapter slack
奇怪的是,当我尝试使用以下方法进行本地开发和测试时:
root@dev:~/hubot# bin/hubot
[Thu Apr 07 2016 00:33:10 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
eve>
eve> help
usage:
history
exit, \q - close shell and exit
help, \? - print this usage
clear, \c - clear the terminal screen
当我在 shell 中键入帮助时,我的 None 个脚本或模块会显示出来。但是当我在 slack 中执行此操作时,我会看到所有可用的脚本和模块:
eve <user> doesn't have <role> role - Removes a role from a user
eve <user> has <role> role - Assigns a role to a user
eve adapter - Reply with the adapter
eve delete reminder <action> - Delete reminder matching <action> (exact match required)
eve deploy <gitsha> to production - Runs Jenkins Phase 1 deployment.
eve echo <text> - Reply back with <text>
eve flip production pools - Flips the yin and yang production pools
eve help - Displays all of the help commands that Hubot knows about.
eve help <query> - Displays all help commands that match <query>.
eve list jobs - List current cron jobs
eve new job "<crontab format>" <message> - Schedule a cron job to say something
eve new job <crontab format> "<message>" - Ditto
eve new job <crontab format> say <message> - Ditto
eve ping - Reply with pong
** 更新 1:我打开了调试级别的日志记录,我可以看到正在解析脚本,但是在执行它们的命令时我无法使用这些脚本 :(**
[Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading adapter shell eve> [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading scripts from /root/hubot/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/example.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/prod_deploy.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/remindme.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/team_tools.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/update.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading scripts from /root/hubot/src/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading hubot-scripts from /root/hubot/node_modules/hubot-scripts/src/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading external-scripts from npm packages [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-diagnostics/src/diagnostics.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379 [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-redis-brain/src/redis-brain.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-auth/src/auth.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-help/src/help.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-cron/src/scripts/cron.coffee
更新 2:我意识到我的部分问题是在 bin/hubot 文件中明确将我的 bot 名称命名为 eve,而我一直在尝试使用 evedev,我的开发 hubot 名称.但是,我仍然想知道为什么 help 命令没有显示所有可用的命令,但是当我在 Slack 中时,它会显示。
您可以在bin/hubot
看起来像exec node_modules/.bin/hubot --name "botname" "$@"
通过以上设置,机器人名称将是 botname
作为对 更新 2 的回答,您需要在键入 help
之前输入机器人的名称,如下所示:
myhubot> help
usage:
history
exit, \q - close shell and exit
help, \? - print this usage
clear, \c - clear the terminal screen
对
myhubot> myhubot help
myhubot> Shell: myhubot adapter - Reply with the adapter
myhubot animate me <query> - The same thing as `image me`, except adds a few parameters to try to return an animated GIF instead.
myhubot echo <text> - Reply back with <text>
myhubot help - Displays all of the help commands that Hubot knows about.
myhubot help <query> - Displays all help commands that match <query>.
myhubot image me <query> - The Original. Queries Google Images for <query> and returns a random top result.
myhubot map me <query> - Returns a map view of the area returned by `query`.
myhubot mustache me <url|query> - Adds a mustache to the specified URL or query result.
myhubot ping - Reply with pong
myhubot pug bomb N - get N pugs
myhubot pug me - Receive a pug
myhubot the rules - Make sure hubot still knows the rules.
myhubot time - Reply with current time
myhubot translate me <phrase> - Searches for a translation for the <phrase> and then prints that bad boy out.
myhubot translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional
ship it - Display a motivation squirrel