<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                在學習擴展開發前,請確保你已經對 Vbot 了如指掌,并且對擴展有了一定的認識。 ## 開發一個屬于自己的擴展! 接下來以開發一個 Hello-World 擴展為例 功能為 收到 hello 時 回復 world 若水平不錯可直接跳過前面步驟,直接看?[擼碼](http://create.hanc.cc/vbot/docs/extensiondevelop.html#擼碼) ### Github 創建項目 ![file](https://dn-phphub.qbox.me/uploads/images/201706/16/4486/PVACofmfMw.png) ### git clone 然后按步驟去初始化 git 和 composer ![file](https://dn-phphub.qbox.me/uploads/images/201706/16/4486/bySHbkDz5t.png) 最終composer.json 可參考?[https://github.com/phpvbot/guess-number/blob/master/composer.json](https://github.com/phpvbot/guess-number/blob/master/composer.json) 在文件`.gitignore`中記得排除掉 composer.lock 以及 .idea (如果沒有此文件可自行在項目根目錄自行創建) ![file](https://dn-phphub.qbox.me/uploads/images/201706/16/4486/emNgO8ji4d.png) ### 擼碼 在項目根目錄新建一個 src 文件夾,新建 HelloWorld 的類,并繼承 AbstractMessageHandler 結構如圖: ![file](https://dn-phphub.qbox.me/uploads/images/201706/16/4486/Bf994ghr2c.png) #### 屬性 屬性都必須填寫 * name 擴展的英文名稱(多單詞以下劃線劃分) * zhName 擴展的中文名稱 * author 作者名稱 * version 版本號,默認為 1.0 (以后需跟隨 github release 版本做變動) * `public static $status = true;`?負責擴展開關(新增加) #### 方法 擴展提供了兩個必須實現的方法 * register 在系統對擴展進行注冊時,會執行一遍且僅執行一遍 * handler 如 消息處理器 的setHandler方法一樣,傳入的是消息數組 最終實現結果: ``` public function handler(Collection $collection) { if ($collection['type'] === 'text' && $collection['content'] === 'hello') { if (($collection['fromType'] === 'Group' && $collection['isAt']) || $collection['fromType'] === 'Friend') { Text::send($collection['from']['UserName'], 'world'); } } } ``` ### 發布 發布只需要提交代碼到github并且發布 release 版本,詳情可看?[如何創建一個自己的 Composer 庫](https://laravel-china.org/articles/4982/how-do-i-create-my-own-composer-library) ## 加入官方擴展組 開發完畢后,可以把機器人拉入 Vbot 體驗群 中進行測試,功能測試以及代碼檢測都過關,可以發郵件到 h@hanc.cc 進行申請,或者 QQ 群上申請均可以。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看