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

    1. <tfoot id='DTDDx'></tfoot>

        <legend id='DTDDx'><style id='DTDDx'><dir id='DTDDx'><q id='DTDDx'></q></dir></style></legend>
          <bdo id='DTDDx'></bdo><ul id='DTDDx'></ul>

      1. <small id='DTDDx'></small><noframes id='DTDDx'>

        <i id='DTDDx'><tr id='DTDDx'><dt id='DTDDx'><q id='DTDDx'><span id='DTDDx'><b id='DTDDx'><form id='DTDDx'><ins id='DTDDx'></ins><ul id='DTDDx'></ul><sub id='DTDDx'></sub></form><legend id='DTDDx'></legend><bdo id='DTDDx'><pre id='DTDDx'><center id='DTDDx'></center></pre></bdo></b><th id='DTDDx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='DTDDx'><tfoot id='DTDDx'></tfoot><dl id='DTDDx'><fieldset id='DTDDx'></fieldset></dl></div>
      2. Discord.py 拼寫檢查命令

        Discord.py spellcheck commands(Discord.py 拼寫檢查命令)

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

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

                <tfoot id='d4ILY'></tfoot>

                  <legend id='d4ILY'><style id='d4ILY'><dir id='d4ILY'><q id='d4ILY'></q></dir></style></legend>
                  本文介紹了Discord.py 拼寫檢查命令的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  最近,我查看了 Stack Overflow,發現了這段代碼可以檢查潛在的拼寫錯誤:

                  Recently, I looked up Stack Overflow and found this code which can check for potential typos:

                  from difflib import SequenceMatcher
                  SequenceMatcher(None, "help", "hepl").ratio()
                  # Returns 0.75
                  

                  這適用于 inside bot 命令的代碼.但是,我應該如何做到這一點,如果我在命令名稱中打錯字,它會更正并執行命令?

                  This works for code inside the bot command. However, how should I make it so, if I make a typo in the command name, it will correct it and execute the command?

                  推薦答案

                  from difflib import SequenceMatcher
                  
                  @bot.event
                  async def on_command_error(ctx, error):
                      if not isinstance(error, commands.CommandNotFound):
                          return
                  
                      message = ctx.message  # later overwrite the attributes
                  
                      used_prefix = ctx.prefix  # the prefix used
                      used_command = message.content.split()[0][len(used_prefix):]  # getting the command, `!foo a b c` -> `foo`
                  
                      available_commands = [cmd.name for cmd in bot.commands]
                      matches = {  # command name: ratio
                          cmd: SequenceMatcher(None, cmd, used_command).ratio()
                          for cmd in available_commands
                      }
                  
                      command = max(matches.items(), key=lambda item: item[1])[0]  # the most similar command
                  
                      try:
                          arguments = message.content.split(" ", 1)[1]
                      except IndexError:
                          arguments = ""  # command didn't take any arguments
                  
                      new_content = f"{used_prefix}{command} {arguments}".strip()
                      message.content = new_content  # overwriting the "original" message
                  
                      await bot.process_commands(message)  # processing commands with the new, updated message
                  

                  這篇關于Discord.py 拼寫檢查命令的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

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

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

                        <bdo id='L2Nxw'></bdo><ul id='L2Nxw'></ul>
                        <legend id='L2Nxw'><style id='L2Nxw'><dir id='L2Nxw'><q id='L2Nxw'></q></dir></style></legend>
                      • <tfoot id='L2Nxw'></tfoot>
                          <tbody id='L2Nxw'></tbody>
                          • 主站蜘蛛池模板: 在线成人免费视频 | 美女视频一区 | 天天欧美 | 亚洲人成人网 | 国产精品久久久久久久久久了 | 精久久久 | 国产精品视频免费播放 | 久久99精品久久久久子伦 | 欧美午夜一区二区三区免费大片 | 国产亚洲一区二区精品 | 91成人在线 | 欧美一区二区大片 | 成人依人| 亚洲精品永久免费 | 日韩欧美国产精品 | 国产精品久久久久久久岛一牛影视 | av黄色国产 | 亚洲成人av| 久久精品亚洲国产奇米99 | 日韩在线免费视频 | 国产精品精品视频一区二区三区 | 亚洲美女在线视频 | 国产精品久久久久久久久图文区 | 欧美成人激情视频 | 欧美成人综合 | 日韩欧美一区二区三区免费观看 | 欧美精品在线免费观看 | 久久专区| 国产高清久久 | 天天久久 | 国产精品九九九 | 国产日韩一区二区三区 | 男人天堂网址 | 午夜影院在线观看免费 | 中文字字幕一区二区三区四区五区 | 国产精品久久久久一区二区三区 | 男女在线免费观看 | 亚洲麻豆| 一区二区在线不卡 | 美女午夜影院 | 久久久久国产一区二区三区四区 |