【PHP Telegram Bot】Day04 - Telegram 机器人的设定

今天要来设定机器人~

按下 /mybots 指令後就会出现机器人列表
https://ithelp.ithome.com.tw/upload/images/20210913/20132916a34F66MEPg.png

Choose a bot from the list below:

选择一个你要查看或设定的机器人
我之前就有建立过机器人,所以会显示两个
https://ithelp.ithome.com.tw/upload/images/20210913/201329167odk17OKiZ.png

Here it is: 2021 iThome铁人赛 @ironman2021_by_miku3920_bot.
What do you want to do with the bot?

点下去後就会出现六个选项,我一个个来讲解:

API Token - 查看 token

https://ithelp.ithome.com.tw/upload/images/20210913/20132916NoJ3Z51pA5.png

Here is the token for bot 2021 iThome铁人赛 @ironman2021_by_miku3920_bot:

1985044907:AAH1kZaEZFHoA6YqB6IFtvbkyOjvcpPOfbQ

忘记 token 时可以来这里查看,或是你想要重置 token

  • Revoke current token - 重置 token
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916EWCHDPQS75.png

    Token for the bot 2021 iThome铁人赛 @ironman2021_by_miku3920_bot has been revoked. New token is:
    
    1985044907:AAG3E05XowN2sqy286aplwr6oBc17q0CByg
    

    按下重置按钮後,它就会给你一个新的 token,旧的会立即失效


Edit Bot - 修改机器人

https://ithelp.ithome.com.tw/upload/images/20210913/201329165B8YFXrvNQ.png

Edit @ironman2021_by_miku3920_bot info.

Name: 2021 iThome铁人赛
Description: ?
About: ?
Botpic: ? no botpic
Commands: no commands yet
  • Edit Name - 修改名字

    按下按钮後会出现以下讯息
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916xf92XTQP9m.png

    OK. Send me the new name for your bot.
    

    直接传送新的名称给它就行了
    https://ithelp.ithome.com.tw/upload/images/20210913/201329160RGcvdXnUs.png

    Success! Name updated. /help
    

    看到这个就是修改成功了


  • Edit Description - 修改说明

    这个会显示在聊天室的最上方,用来说明机器人有能些功能,或是如何使用
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916RQD6maX2nz.png

    OK. Send me the new description for the bot. People will see this description when they open a chat with your bot, in a block titled 'What can this bot do?'.
    

    传送一段讯息给它,可以是多行的文字
    https://ithelp.ithome.com.tw/upload/images/20210913/201329161aJeqmhrYC.png

    Success! Description updated. /help
    

    看到这个就是修改成功了
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916RwWlZwalJO.png
    原本在聊天室上方啥都没有,现在多了一个讯息框


  • Edit About - 修改简介

    这个会显示在机器人的个人资讯页面上
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916cmtiFhxWWS.png

    OK. Send me the new 'About' text. People will see this text on the bot's profile page and it will be sent together with a link to your bot when they share it with someone.
    

    传送一段讯息给它,可以是多行的文字
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916xbuuFg828G.png

    Success! About section updated. /help
    

    看到这个就是修改成功了
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916zkGAHlcLXh.png
    原本是只有显示 username,现在多了简介


  • Edit Botpic - 修改大头贴
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916qCh3V468Hu.png

    OK. Send me the new profile photo for the bot.
    

    建议先裁切成正方形(1:1)
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916VQ2bwEulVw.png

    Please send me the picture as a 'Photo', not as a 'File'.
    

    这边要传送照片,不能传档案
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916EaQ3LoV7Mu.png

    Success! Profile photo updated. /help
    

    成功的话,机器人的大头贴就会更新成刚刚上传的图片
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916uoyMFnP48K.png


  • Edit Commands - 修改指令选单
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916WpvBFGp62Y.png

    OK. Send me a list of commands for your bot. Please use this format:
    
    command1 - Description
    command2 - Another description
    
    Send /empty to keep the list empty.
    

    要按照它给的格式输入,不需要打 /
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916IquQRpcBnl.png

    Success! Command list updated. /help
    

    成功的话,选单中就会出现刚刚设定的指令
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916KUjh6J3HW7.png
    如果机器人是在群组使用,建议改成空的,避免误触
    群组里较常使用 ! 开头的指令,这样才不会变成蓝蓝的容易按到
    在刚刚那边,按 /empty 就行了
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916T7kisuYvXd.png


修改完会变成这样:
https://ithelp.ithome.com.tw/upload/images/20210913/20132916HCyaUvqUSp.png

Edit @ironman2021_by_miku3920_bot info.

Name: 2021 iThome铁人赛
Description: 一些说明文字,功能如下:

1. AAA
2. BBB
3. CCC
About: 铁人赛展示用机器人 by @miku3920
铁人赛展示用机器人 by @miku3920
铁人赛展示用机器人 by @miku3920
Botpic: ? has a botpic
Commands: no commands yet

Bot Settings - 设定机器人

https://ithelp.ithome.com.tw/upload/images/20210913/20132916c6WBvcVVBT.png

Settings for @ironman2021_by_miku3920_bot.
  • Inline Mode - 内联模式(内嵌模式)

    可以让机器人直接在讯息输入框使用,不需要将机器人加入群组
    这个功能够讲一整天了,目前还用不到,我们以後专门找一天来讲
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916Fb4zg1In8p.png


  • Allow Group? - 是否能被加入群组?
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916MHj9cOwCb6.png

    Groups are currently enabled for bot 2021 iThome铁人赛 @ironman2021_by_miku3920_bot
    
    Disabling groups will forbid users to add 2021 iThome铁人赛 to groups.
    

    enabled(预设) - 表示机器人被别人拉进群组
    如果你不想让别人拉你的机器人,可以按 Turn groups off


    https://ithelp.ithome.com.tw/upload/images/20210913/20132916gkdA9RTOz1.png

    Groups are currently disabled for bot 2021 iThome铁人赛 @ironman2021_by_miku3920_bot.
    
    Enabling groups will allow users to add 2021 iThome铁人赛 to groups.
    

    disabled - 表示机器人不能被别人拉进群组
    如果你想让别人的群组也能使用你的机器人,就按 Turn groups on


  • Group Privacy - 是否能读取所有聊天室讯息

    官方说明:https://core.telegram.org/bots#privacy-mode
    https://ithelp.ithome.com.tw/upload/images/20210913/201329161u3BZDHDdA.png

    Privacy mode is enabled for 2021 iThome铁人赛 @ironman2021_by_miku3920_bot.
    

    enabled(预设) - 表示机器人是成员时不能读取群组里的所有讯息
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916pzkkVqNv1e.png
    机器人只看的到它的指令和回覆它的讯息
    https://ithelp.ithome.com.tw/upload/images/20210913/201329164v5RZzZ8nZ.png
    但是如果升级成管理员就没这限制


    https://ithelp.ithome.com.tw/upload/images/20210913/20132916CnXaxxuyQO.png

    Privacy mode is disabled for 2021 iThome铁人赛 @ironman2021_by_miku3920_bot.
    

    disabled - 表示机器人就算不是管理员也读取群组里的所有讯息
    https://ithelp.ithome.com.tw/upload/images/20210913/2013291666UHDAeSg2.png
    机器人是成员时就能读取所有讯息


  • Payments - 付款相关设定

    台湾不能用,有生之年系列,跳过


  • Domain - 网站登入用

    与机器人较无关,暂时不提


Payments - 付款相关设定

https://ithelp.ithome.com.tw/upload/images/20210913/20132916GOvlEAqxP0.png
欧付宝、绿界、台湾 pay、街口、悠游付,不考虑进驻一下吗


Transfer Ownership - 转移机器人

⚠️ 注意:非必要请勿使用!
https://ithelp.ithome.com.tw/upload/images/20210913/20132916Sfhdggu39h.png

  • Choose recipient - 选择使用者
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916InbUAr8MtD.png

    Please share the new owner's contact or their username.
    

    按下按钮後,它会请你把对方以联络人的方式分享给它,或是输入对方的 username


    常见问题:

    • 要输入 @username,不能只输入 username
      https://ithelp.ithome.com.tw/upload/images/20210913/20132916M12gG75Iz2.png

      Incorrect format. Please make sure to send either a contact or username.
      
    • 不能转移给频道、机器人、或是自己
      https://ithelp.ithome.com.tw/upload/images/20210913/20132916leUV2F3WrT.png

      Bot ownership can't be transferred to channel, another bot or yourself.
      
    • 对方要私讯过机器人,而且不能封锁机器人
      https://ithelp.ithome.com.tw/upload/images/20210913/20132916mtKhjsExi4.png

      Oops! Please make sure the new owner has sent at least one message to the bot and didn't block it.
      

    输入正确的话,就会出现以下讯息:
    https://ithelp.ithome.com.tw/upload/images/20210913/20132916bmr5Uz5Lfl.png

    You are about to transfer ownership of the bot @ironman2021_by_miku3920_bot to 初音 ミク.
    
    After this you won't be able to control the bot anymore. The new owner will get access to the bot messages and other data – and can even delete the bot completely.
    
    Please make sure you don't violate your users' privacy (consider GDPR and other laws). If you are sure please press the button below.
    

    看到这则讯息代表离成功转移不远了

    • Yes, I am sure, proceed. - 确认转移
      https://ithelp.ithome.com.tw/upload/images/20210913/20132916GsIP1cHr21.png
      如果你有设定两步骤验证的话,这边会跳出来要你输入


      常见问题:

      • 对方拥有的机器人数量已达上限
        https://ithelp.ithome.com.tw/upload/images/20210913/20132916V3NbMAaeTD.png

        Oops! has reached the maximum allowed number of bots. Please ask them to delete (or pass to another account) one of their unused bots first.
        

        如果对方已经有 20 只机器人(达到上限),就会出现这个对话框,他请你先叫对方转移或删除一些没在用的机器人,这样你才可以转移给对方。


      https://ithelp.ithome.com.tw/upload/images/20210913/20132916ihSKToQY2e.png

      It worked! We hope @ironman2021_by_miku3920_bot will enjoy its new home.
      

      如果转移成功就会出现这则讯息

      https://ithelp.ithome.com.tw/upload/images/20210913/20132916rOcBGIIXxL.png

      Ownership of the bot @ironman2021_by_miku3920_bot has been transferred to you by 初音 ミク. You can now control the bot using /mybots.
      
      If you did not request this, you can delete the bot.
      

      对方会收到一则这样的讯息


Delete Bot - 删除机器人

⚠️ 注意:非必要请勿使用!
https://ithelp.ithome.com.tw/upload/images/20210913/20132916P7QKGHg8Ea.png

You are about to delete your bot 2021 iThome铁人赛 @ironman2021_by_miku3920_bot. Is that correct?

这边的按钮顺序是随机的,避免你头脑不清楚把机器人删了
https://ithelp.ithome.com.tw/upload/images/20210913/20132916PrquRBqk6d.png

Are you TOTALLY sure you want to delete 2021 iThome铁人赛 @ironman2021_by_miku3920_bot ?

要连续按两次 Yes 机器人才会被删掉
https://ithelp.ithome.com.tw/upload/images/20210913/20132916UbKBOVHpbC.png

You have deleted 2021 iThome铁人赛 @ironman2021_by_miku3920_bot.

看到这则讯息表示机器人已经删除,无法复原
所有群组里的这只机器人都会显示成 Deleted Account


<<:  Day13 原来Background可以有这麽多设定

>>:  【第十三天 - 递回 题目分析】

前言

大家好我是 KAI,这是我第一次参与 IT 铁人赛。 这次打算用30天的时间去复习并练习网页设计,把...

Day 0x15 - 代码建立 (Part 1: 回覆讯息代码)

0x1 前言 错误码不管是在开发或是正式环境中不可或缺的一环,能为开发或维护带来不少的方便性,有个方...

D-15 过滤器 ? filter ? attribute

filter 眼尖的小光在昨日的内容中看到了一个有趣的东西,就是MiddlewareFilter,所...

Day13:穷理致知

虽然现在履历都会写自己台大毕业,但我对自身学历是台大的认同感还是远不如成大,毕竟好歹也待了4年,而且...

Day 12 多工等待跟号志同步与信用追踪同步

我们在本篇来说一下,号志使用的第二种方式:多工等待跟号志同步。 如果说,有三个优先任务在执行多工处理...