久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='bmhVD'><style id='bmhVD'><dir id='bmhVD'><q id='bmhVD'></q></dir></style></legend>

    <tfoot id='bmhVD'></tfoot>

      • <bdo id='bmhVD'></bdo><ul id='bmhVD'></ul>
      <i id='bmhVD'><tr id='bmhVD'><dt id='bmhVD'><q id='bmhVD'><span id='bmhVD'><b id='bmhVD'><form id='bmhVD'><ins id='bmhVD'></ins><ul id='bmhVD'></ul><sub id='bmhVD'></sub></form><legend id='bmhVD'></legend><bdo id='bmhVD'><pre id='bmhVD'><center id='bmhVD'></center></pre></bdo></b><th id='bmhVD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bmhVD'><tfoot id='bmhVD'></tfoot><dl id='bmhVD'><fieldset id='bmhVD'></fieldset></dl></div>

        <small id='bmhVD'></small><noframes id='bmhVD'>

      1. Bot 和 Client 有什么區別?

        What are the differences between Bot and Client?(Bot 和 Client 有什么區別?)

          <i id='0vDP3'><tr id='0vDP3'><dt id='0vDP3'><q id='0vDP3'><span id='0vDP3'><b id='0vDP3'><form id='0vDP3'><ins id='0vDP3'></ins><ul id='0vDP3'></ul><sub id='0vDP3'></sub></form><legend id='0vDP3'></legend><bdo id='0vDP3'><pre id='0vDP3'><center id='0vDP3'></center></pre></bdo></b><th id='0vDP3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0vDP3'><tfoot id='0vDP3'></tfoot><dl id='0vDP3'><fieldset id='0vDP3'></fieldset></dl></div>
            <bdo id='0vDP3'></bdo><ul id='0vDP3'></ul>
              <tfoot id='0vDP3'></tfoot>

              <small id='0vDP3'></small><noframes id='0vDP3'>

            • <legend id='0vDP3'><style id='0vDP3'><dir id='0vDP3'><q id='0vDP3'></q></dir></style></legend>
                <tbody id='0vDP3'></tbody>

                • 本文介紹了Bot 和 Client 有什么區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我已經瀏覽了一些關于如何制作 Discord Python Bot 的示例,并且我已經看到 clientbot 幾乎可以互換使用,我正在無法找到你什么時候會使用哪一個.

                  I've been going through some examples on how to make a Discord Python Bot and I've been seeing client and bot being used almost interchangeably and I'm not able to find when you would use which one when.

                  例如:

                  client = discord.Client()
                  @client.event
                  async def on_message(message):
                      # we do not want the bot to reply to itself
                      if message.author == client.user:
                          return
                  
                      if message.content.startswith('$guess'):
                          await client.send_message(message.channel, 'Guess a number between 1 to 10')
                  
                      def guess_check(m):
                          return m.content.isdigit()
                  
                  @client.event
                  async def on_ready():
                      print('Logged in as')
                      print(client.user.name)
                      print(client.user.id)
                      print('------')
                  
                  client.run('token')
                  

                  對比

                  bot = commands.Bot(command_prefix='?', description=description)
                  @bot.event
                  async def on_ready():
                      print('Logged in as')
                      print(bot.user.name)
                      print(bot.user.id)
                      print('------')
                  
                  @bot.command()
                  async def add(left : int, right : int):
                      """Adds two numbers together."""
                      await bot.say(left + right)
                  
                  bot.run('token')
                  

                  我開始認為它們具有非常相似的品質并且可以做同樣的事情,但個人偏好是與客戶端一起使用而不是與機器人一起使用.但是,它們確實存在差異,客戶端具有 on_message 而機器人等待 prefix 命令.

                  I'm beginning to think they have very similar qualities and can do the same things but is a personal preference to go with a client vs. a bot. However they do have their differences where clients have an on_message while bots wait for a prefix command.

                  有人可以澄清clientbot之間的區別嗎?

                  Can someone please clarify the difference between client and bot?

                  推薦答案

                  Tl;dr

                  只需使用 commands.Bot.

                  BotClient 的擴展版本(它處于子類 關系中).IE.它是啟用了命令的客戶端的擴展,因此是子目錄 ext/commands 的名稱.

                  Bot is an extended version of Client (it's in a subclass relationship). Ie. it's an extension of Client with commands enabled, thus the name of the subdirectory ext/commands.

                  Bot 類繼承了 Client 的所有功能,這意味著您可以使用 ClientBot 也可以.最引人注目的新增功能是命令驅動(@bot.command()),而使用 Client 時您必須手動處理事件.Bot 的一個缺點是您必須通過查看示例或源代碼來學習其他功能,因為命令擴展沒有太多文檔記錄.UPD:現在記錄在這里.

                  The Bot class inherits all the functionalities of Client, which means that everything you can do with Client, Bot can do it too. The most noticeable addition was becoming command-driven (@bot.command()), whereas you would have to manually work with handling events when using Client. A downside of Bot is that you will have to learn the additional functionalities from looking at examples or source codes since the commands extension isn't much documented. UPD: Now it is documented here.

                  如果你只是想讓你的機器人接受命令并處理它們,那么使用 Bot 會容易得多,因為所有的處理和預處理都是為你完成的.但是,如果您渴望編寫自己的句柄并使用 discord.py 做瘋狂的特技,那么請務必使用基礎 Client.

                  If you simply want your bots to accept commands and handle them, it would be a lot easier to work with the Bot since all the handling and preprocessing are done for you. But if you're eager to write your own handles and do crazy stunts with discord.py, then by all means, use the base Client.

                  如果您不知道如何選擇,我建議您使用 commands.Bot,因為它更容易使用,并且除了 Client 已經可以了.請記住,您不需要兩者.

                  In case you're stumped by which to choose, I recommend you to use commands.Bot since it's a lot easier to work with and it's in addition of everything Client can already do. And please remember that you do not need both.

                  錯誤:

                  client = discord.Client()
                  bot = commands.Bot(".")
                  
                  # do stuff with bot
                  

                  正確:

                  bot = commands.Bot(".")
                  
                  # do stuff with bot
                  

                  這篇關于Bot 和 Client 有什么區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發帶有已編譯動態共享庫的 Python 包)
                      <tbody id='hButN'></tbody>

                      <small id='hButN'></small><noframes id='hButN'>

                      <tfoot id='hButN'></tfoot>
                      <legend id='hButN'><style id='hButN'><dir id='hButN'><q id='hButN'></q></dir></style></legend>

                          <bdo id='hButN'></bdo><ul id='hButN'></ul>

                          • <i id='hButN'><tr id='hButN'><dt id='hButN'><q id='hButN'><span id='hButN'><b id='hButN'><form id='hButN'><ins id='hButN'></ins><ul id='hButN'></ul><sub id='hButN'></sub></form><legend id='hButN'></legend><bdo id='hButN'><pre id='hButN'><center id='hButN'></center></pre></bdo></b><th id='hButN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hButN'><tfoot id='hButN'></tfoot><dl id='hButN'><fieldset id='hButN'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 久久午夜国产精品www忘忧草 | 亚洲自拍偷拍av | 亚洲精品自拍 | 精品九九九 | 亚洲精品成人在线 | 人人鲁人人莫人人爱精品 | 亚洲精品在线看 | 久久99精品久久久水蜜桃 | 亚洲国产精品久久人人爱 | 亚洲欧美在线观看 | 久久久tv | 国产精品免费一区二区 | av日韩高清 | 三级特黄特色视频 | jlzzjlzz国产精品久久 | 久久国产综合 | 国产精品成人品 | 91久久北条麻妃一区二区三区 | 国产精品国产三级国产a | 久久精品综合 | 亚洲午夜精品视频 | 亚洲精品99999 | 一区视频在线播放 | 国产一区二区在线播放 | 中文字幕在线三区 | av黄色国产 | 国产一区二 | 久久久不卡网国产精品一区 | 久久精品久久久久久 | 久久精品无码一区二区三区 | 伊人网伊人网 | 国产精品视频久久久久 | 99久久精品视频免费 | wwww.xxxx免费| 国产精品美女久久久久久不卡 | 91在线综合 | 国产精品久久久久久久久免费高清 | 国产日韩精品久久 | 在线国产一区二区 | 欧美日韩黄色一级片 | 日韩av成人 |