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

    • <bdo id='yF20Z'></bdo><ul id='yF20Z'></ul>
    1. <tfoot id='yF20Z'></tfoot>

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

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

      1. Discord.py discord.NotFound 異常

        Discord.py discord.NotFound exception(Discord.py discord.NotFound 異常)
          <bdo id='cMuJV'></bdo><ul id='cMuJV'></ul>

        • <small id='cMuJV'></small><noframes id='cMuJV'>

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

                    <tbody id='cMuJV'></tbody>
                1. 本文介紹了Discord.py discord.NotFound 異常的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  每個人.我一直在為我的不和諧服務器開發一些機器人,但我在其中一個機器人中遇到了一個我似乎無法解決的問題.我有一個名為info"的命令,本質上,該命令顯示有關所需用戶的一些信息.當我調用命令 ?info [user] 時,它工作得很好,直到我故意請求不存在的用戶的信息來測試我已經到位的異常.這里'

                  everyone. I've been working on a few bots for my discord server and I've come across an issue in one of them which I cant seem to solve. I have a command called 'info', essentially, this command displays some information on a desired user. When I call the command ?info [user], it works just fine until I intentionally request the info on a user that doesn't exist to test an exception I have in place. Here'

                  @laugh.command(pass_context=True)
                  async def info(ctx, user: discord.Member = None):
                      if ctx.message.channel.name != "admin":
                          await laugh.send_message(ctx.message.author, "Sorry, you need to be in a text channel called 'admin' for that.")
                          return
                      if not ctx.message.author.server_permissions.administrator:
                          return
                      if not user:
                          user = ctx.message.author
                      try:
                          minfo = ("""
                  {0}'s ID is: {1}
                  {0}'s status is: {2}
                  {0}'s highest role is: {3}
                  {0} joined at: {4}""".format(user.name, user.id, user.status, user.top_role, user.joined_at))
                          embed = discord.Embed(title = user.name, description = minfo, color = 0x00D2FF)
                          await laugh.say(embed = embed)
                      except discord.NotFound:
                          await laugh.say("User not found.")
                  

                  當我運行此代碼并將不存在的用戶作為參數時,我的異常不起作用,相反,我將此輸出到我的控制臺:

                  When I run this code and give a non-existent user as parameters, my exception doesn't work, instead, I get this output to my console:

                  Ignoring exception in command info
                  Traceback (most recent call last):
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandsot.py", line 846, in process_commands
                      yield from command.invoke(ctx)
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 367, in invoke
                      yield from self.prepare(ctx)
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 345, in prepare
                      yield from self._parse_arguments(ctx)
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 304, in _parse_arguments
                      transformed = yield from self.transform(ctx, param)
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 223, in transform
                      raise e
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 221, in transform
                      return (yield from self.do_conversion(ctx, converter, argument))
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandscore.py", line 184, in do_conversion
                      return instance.convert()
                    File "C:UsersMatthewAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordextcommandsconverter.py", line 100, in convert
                      raise BadArgument('Member "{}" not found'.format(self.argument))
                  discord.ext.commands.errors.BadArgument: Member "test" not found
                  

                  我查看了無數示例和論壇帖子,我獲得的唯一知識是錯誤的根源在于 async def info(ctx, user: discord.Member = None):,關于我能做什么的任何想法?

                  I've looked at countless examples and forums posts and the only knowledge I've gained was that the source of the error is in async def info(ctx, user: discord.Member = None):, any ideas on what I can do?

                  推薦答案

                  命令的錯誤處理有點奇怪.當您為參數 user 指定轉換器時,該轉換發生在命令協程的主體之外.要處理它,您必須編寫一個錯誤處理程序協程,并將其與相關命令相關聯.

                  Error handling for commands is a little weird. When you specify a converter for the argument user, that conversion takes place outside of the body of the command coroutine. To handle it, you must write an error handler coroutine, and associate it with the command in question.

                  @laugh.command(pass_context=True)
                  async def info(ctx, user: discord.Member = None):
                      if ctx.message.channel.name != "admin":
                          await laugh.send_message(ctx.message.author, "Sorry, you need to be in a text channel called 'admin' for that.")
                          return
                      if not ctx.message.author.server_permissions.administrator:
                          return
                      if not user:
                          user = ctx.message.author
                      minfo = ("""
                  {0}'s ID is: {1}
                  {0}'s status is: {2}
                  {0}'s highest role is: {3}
                  {0} joined at: {4}""".format(user.name, user.id, user.status, user.top_role, user.joined_at))
                      embed = discord.Embed(title = user.name, description = minfo, color = 0x00D2FF)
                      await laugh.say(embed = embed)
                  
                  @info.error
                  async def info_error(ctx, error): # This might need to be (error, ctx), I'm not sure
                      if isinstance(error, commands.BadArgument):
                          await laugh.say('I could not find that user')
                  

                  您可以在 discord.ext.commands 模塊的其余部分rewrite/ext/commands/commands.html#error-handling" rel="nofollow noreferrer">rewrite 分支的文檔.

                  You can read the documentation for error handlers, and the rest of the discord.ext.commands module, in the documentation for the rewrite branch.

                  如果您要使用命令擴展做大量工作,現在轉換您的代碼以便您可以使用準確的文檔可能是有意義的.

                  If you're going to be doing a lot of work with the commands extension, it may make sense to convert your code now so that you can work with accurate documentation.

                  這篇關于Discord.py discord.NotFound 異常的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='dBRkN'><tr id='dBRkN'><dt id='dBRkN'><q id='dBRkN'><span id='dBRkN'><b id='dBRkN'><form id='dBRkN'><ins id='dBRkN'></ins><ul id='dBRkN'></ul><sub id='dBRkN'></sub></form><legend id='dBRkN'></legend><bdo id='dBRkN'><pre id='dBRkN'><center id='dBRkN'></center></pre></bdo></b><th id='dBRkN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='dBRkN'><tfoot id='dBRkN'></tfoot><dl id='dBRkN'><fieldset id='dBRkN'></fieldset></dl></div>

                        <tfoot id='dBRkN'></tfoot>

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

                          <bdo id='dBRkN'></bdo><ul id='dBRkN'></ul>
                          <legend id='dBRkN'><style id='dBRkN'><dir id='dBRkN'><q id='dBRkN'></q></dir></style></legend>
                            <tbody id='dBRkN'></tbody>
                          • 主站蜘蛛池模板: 手机看片在线播放 | 亚洲精品久久久久中文字幕欢迎你 | 免费午夜视频 | 国产成人99久久亚洲综合精品 | 日韩午夜影院 | 日本一区二区三区四区 | 免费v片| 亚洲国产成人久久久 | 一区二区在线看 | 久久99蜜桃综合影院免费观看 | 国产精品成人一区二区三区 | 亚洲视频在线观看 | 亚洲高清在线 | a毛片| 99久久国产综合精品麻豆 | 一区二区三区在线免费看 | 国产视频中文字幕 | 欧美日韩在线精品 | 在线国产视频 | 日韩成人av在线播放 | 久久久久久久亚洲精品 | 欧美精品一区二区三区在线 | 亚洲精品久久久久久一区二区 | 91精品国产91综合久久蜜臀 | 欧美在线a | 最近免费日本视频在线 | 免费大黄视频 | 欧美人妖网站 | 影音av| 亚洲精品不卡 | 亚洲国产精品久久人人爱 | 亚洲精品乱码久久久久v最新版 | 91色视频在线观看 | 日韩一区二区在线视频 | 日韩a v在线免费观看 | 久久国产精品首页 | 国产精品久久久久久久久免费丝袜 | 国产精品精品视频一区二区三区 | 欧美一区二区三区电影 | 欧美精品一区二区三区四区 | 成人永久免费视频 |