最全彩票网,彩票网官方网址,最全彩票网导航页

  • <tr id='fn2EsL'><strong id='fn2EsL'></strong><small id='fn2EsL'></small><button id='fn2EsL'></button><li id='fn2EsL'><noscript id='fn2EsL'><big id='fn2EsL'></big><dt id='fn2EsL'></dt></noscript></li></tr><ol id='fn2EsL'><option id='fn2EsL'><table id='fn2EsL'><blockquote id='fn2EsL'><tbody id='fn2EsL'></tbody></blockquote></table></option></ol><u id='fn2EsL'></u><kbd id='fn2EsL'><kbd id='fn2EsL'></kbd></kbd>

    <code id='fn2EsL'><strong id='fn2EsL'></strong></code>

    <fieldset id='fn2EsL'></fieldset>
          <span id='fn2EsL'></span>

              <ins id='fn2EsL'></ins>
              <acronym id='fn2EsL'><em id='fn2EsL'></em><td id='fn2EsL'><div id='fn2EsL'></div></td></acronym><address id='fn2EsL'><big id='fn2EsL'><big id='fn2EsL'></big><legend id='fn2EsL'></legend></big></address>

              <i id='fn2EsL'><div id='fn2EsL'><ins id='fn2EsL'></ins></div></i>
              <i id='fn2EsL'></i>
            1. <dl id='fn2EsL'></dl>
              1. <blockquote id='fn2EsL'><q id='fn2EsL'><noscript id='fn2EsL'></noscript><dt id='fn2EsL'></dt></q></blockquote><noframes id='fn2EsL'><i id='fn2EsL'></i>

                行业动态

                了解最新公司动态及行业资讯

                当前位置:首页>新闻中心>行业动态
                全部 4017 公司动态 881 行业动态 3136

                中国自定义▼机器人脚本开发脚本介绍

                时间:2022-12-13   访问量:1786

                开发自定义机器人脚本

                首先,在决定开发自定义脚本时,可以使用 npm 命令查看是否有类似的脚本可】用。

                $ npm search hubot-scripts github
                NAME                  DESCRIPTION
                hubot-deployer        Giving Hubot the ability to deploy GitHub repos to PaaS providers hubot hubot-scripts hubot-gith
                hubot-gh-release-pr   A hubot script to create GitHub's PR for release hubot-github Giving Hubot the ability to be a vital member of your github organization … 

                应用 NPM 包:

                npm --save 首先将 -name 添加到 -.json

                项目结构

                默认需要导出一个№:

                module.exports = (robot) ->
                  # your code here

                首先我们创建我们的第一个脚本,你好。

                module.exports = (robot) ->
                    robot.respond /greet/i, (res) ->
                    res.send 'hello world.'

                重启,输入greet

                myhubot> myhubot greet
                myhubot> hello world.

                Hubot 语法 &

                可以收听房间或群组中的任何消息。

                只监听直接发给机器人的╳消息,即需要指定机器人名称或别名服■务器运维,添加机器人♀名称为rob,别名为/,则如下格式会触发脚本:

                - rob open the pod bay doors - ROB: open the pod bay doors - @ROB open the pod bay doors - /open the pod bay doors 

                发送★和回复

                res参数是实例服务器运◢维,如果你想从bot返回消息,你可以使用send或reply。

                发送会将消息发送到整个聊天室或群组。

                reply 将消息回复给特定≡的人。

                更多信息请参考官网

                更复杂的例△子

                Hubot是基于node.js开发的,所以它能做node.js能做的,比如:

                示例:查看服务器端日历信息

                /.

                child_process = require('child_process')
                module.exports = (robot) ->
                    robot.respond /(cal|日历)( me)?/i, (res) ->
                        child_process.exec 'cal', (err, stdout, stderr) ->
                            res.send(stdout)

                重启,输入cal,可以看到控制台⊙返回了服务器的日历信息

                Su Mo Tu We Th Fr Sa
                
                 1  2  3  4  5  6  7
                 8  9 10 11 12 13 14
                15 16 17 18 19 20 21
                22 23 24 25 26 27 28
                29 30 31

                捕获所有未处理的信息

                为了让机器人的响应更加友好,您可@以为无法识别的信息设置一个默认的返回信息。

                /.

                module.exports = (robot) ->
                  robot.catchAll (res) ->
                    res.send "主人,无法识别您的指令:#{res.message.text}"

                融入微信

                hubot 默@ 认提供两种类型,shell 和 .

                shell提供了命令行方式,开发调试或者运维还好,聊天就太差了。

                聊天工具在国内听说过的人不多,不用也无所谓。

                依托hubot灵活的扩展机制,社区提供各种聊天工具的集成。它可以在〇官方网站上找到。

                不过在中国,最流行的聊天软件当然是微信了。把自己的聊▃天机器人绑定到自己的微信账号上,和它调情,是不是很有趣?

                还好已经有人发了微▲信,地址:

                接下来,我们将 Hub- 集成到我们的项目中。

                npm install hubot-weixin --save

                运行,设置名称为bot,别名/,这样只需要输入/cal就可以激活机器人。

                binhubot.cmd -n bot -l / -a weixin

                当然,这样运行命令『会出现错误。hubot-work的主要机制是破解网页版微信协议。首先用手机登录微信账号,然后模拟网页版微信登录,这样就可︼以接收微信消息了。

                可以设置如下:

                1、先为机〓器人注册一个新的微信公众号或使用已有的微信公众号;

                2、登录手机微◥信;

                服务器运维_运维服务管理体系建设_视频会议系统运维服务

                3、浏览器打开网页╱微信:,F12打开控制台监听请求信息;

                4.手机扫一〒扫登录;

                5.控制台要监听很多请求信息;

                6、从这些请求信息中找到如下信息,填入.//hubot-/.yaml:

                cookie:
                Uin:
                Sid:
                Skey: 
                DeviceID:

                现在,再次∏运行命令。如果有错误,请按照刚才的步骤检查参数设置是否正确,或◆者使用其他工具进行调试。

                binhubot.cmd -n bot -l / -a weixin

                正↙确启动后,您可以通过微信给机器人发送消息。

                下一个

                接下来,考虑做一些更有趣∑的事情。

                上一篇:1.金蝶K/云ERP能给企业带来什么价值?

                下一篇:一台电脑接两▲根网线同时上网网线接长的解决方法(组图)

                发表评论:

                评论记录:

                未查询到↓任何数据!

                在线咨询

                点击这里给我发消息 售前咨询专员

                点击这里给我发消息 售后服务专员

                在线咨询

                免费通话

                24小时免费咨ζ询

                请输入您的联系电〖话,座机请加区号

                免费通话

                微信扫一扫

                微信联系
                返回顶部