久久久久久久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>
                          • 主站蜘蛛池模板: 免费观看一级特黄欧美大片 | 中文字幕精品一区二区三区精品 | 中文字幕亚洲欧美 | 国产特级毛片 | 草久久久| 成人福利网 | 日韩一区二区三区在线观看 | 亚洲精品久久久久国产 | 午夜电影网站 | 国产精品伦一区二区三级视频 | 精品欧美一区二区三区久久久 | 成人一区二区视频 | 在线亚洲一区 | 美人の美乳で授乳プレイ | 国产精华一区 | 日本午夜在线视频 | 久久亚洲国产精品 | 国产免费观看久久黄av片涩av | 日韩精品一区二区三区在线观看 | 999免费视频 | a级免费观看视频 | 天天草天天干天天 | 欧美一二区 | 久久国产精品免费一区二区三区 | 99热播精品 | 一区二区三区亚洲 | 2022国产精品 | 国产精品福利网站 | 精品一区二区三区在线视频 | 欧美a在线 | 午夜精品视频在线观看 | 欧美精品久久久 | 国产探花在线观看视频 | 亚洲精品国产a久久久久久 午夜影院网站 | 少妇一区在线观看 | 久久国产精品无码网站 | av黄色在线 | 色婷婷av久久久久久久 | 午夜在线电影网 | 国产欧美日韩在线播放 | 国产欧美一区二区久久性色99 |