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

  • <tfoot id='DU2ag'></tfoot>

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

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

      <legend id='DU2ag'><style id='DU2ag'><dir id='DU2ag'><q id='DU2ag'></q></dir></style></legend>
      1. 檢查用戶是否在語音頻道 discord.py

        Check if user is in a voice channel discord.py(檢查用戶是否在語音頻道 discord.py)
          <tbody id='bvi3V'></tbody>
      2. <i id='bvi3V'><tr id='bvi3V'><dt id='bvi3V'><q id='bvi3V'><span id='bvi3V'><b id='bvi3V'><form id='bvi3V'><ins id='bvi3V'></ins><ul id='bvi3V'></ul><sub id='bvi3V'></sub></form><legend id='bvi3V'></legend><bdo id='bvi3V'><pre id='bvi3V'><center id='bvi3V'></center></pre></bdo></b><th id='bvi3V'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bvi3V'><tfoot id='bvi3V'></tfoot><dl id='bvi3V'><fieldset id='bvi3V'></fieldset></dl></div>
        <tfoot id='bvi3V'></tfoot>
        <legend id='bvi3V'><style id='bvi3V'><dir id='bvi3V'><q id='bvi3V'></q></dir></style></legend>

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

                  <bdo id='bvi3V'></bdo><ul id='bvi3V'></ul>
                • 本文介紹了檢查用戶是否在語音頻道 discord.py的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在制作一個可以在 vc 中播放聲音的機器人.我已經(jīng)編寫了加入通話的代碼,播放 mp3,然后離開通話,但是當(dāng)用戶不在通話中時,我收到此錯誤:

                  I am making a bot that will play sounds in a vc. I have made the code to join the call, play the mp3, then leave the call but when the user is not in a call I get this error:

                  Ignoring exception in command ring:
                  Traceback (most recent call last):
                    File "C:UsersmaxAppDataRoamingPythonPython39site-packagesdiscordextcommandscore.py", line 85, in wrapped
                      ret = await coro(*args, **kwargs)
                    File "C:UsersmaxOneDriveDesktopCodeDiscordBotsNokiaNokia.py", line 91, in ring
                      channel = ctx.author.voice.channel
                  AttributeError: 'NoneType' object has no attribute 'channel'
                  
                  The above exception was the direct cause of the following exception:
                  
                  Traceback (most recent call last):
                    File "C:UsersmaxAppDataRoamingPythonPython39site-packagesdiscordextcommandsot.py", line 903, in invoke
                      await ctx.command.invoke(ctx)
                    File "C:UsersmaxAppDataRoamingPythonPython39site-packagesdiscordextcommandscore.py", line 859, in invoke
                      await injected(*ctx.args, **ctx.kwargs)
                    File "C:UsersmaxAppDataRoamingPythonPython39site-packagesdiscordextcommandscore.py", line 94, in wrapped
                      raise CommandInvokeError(exc) from exc
                  discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
                  

                  這是我目前擁有的代碼:

                  This is my code that I have so far:

                  @client.command()
                  async def ring(ctx):
                      channel = ctx.author.voice.channel
                      vc = await channel.connect()
                      vc.play(discord.FFmpegPCMAudio("Audio/NokiaRingtone.mp3"))
                      time.sleep(5)
                      await ctx.voice_client.disconnect()
                  

                  還有一件事;我想知道為什么當(dāng)我的機器人與 vc 斷開連接時,我會在聊天中得到這些:

                  One more thing; I was wondering why I get these in the chat when my bot disconnects from the vc:

                  websocket connection is closing.
                  websocket connection is closing.
                  websocket connection is closing.
                  

                  如果有人可以幫我檢查用戶是否在語音頻道中,并告訴我為什么我的控制臺中有這三行,那就太好了.

                  If anyone could help me check if the user is in a voice channel and tell me why I get those three lines in my console that would be great.

                  推薦答案

                  你可以簡單地用 if 語句檢查它是否不是非類型

                  You can simply check if it's not a nonetype with an if statement

                  @bot.command()
                  async def foo(ctx):
                      voice_state = ctx.member.voice
                  
                      if voice_state is None:
                          # Exiting if the user is not in a voice channel
                          return await ctx.send('You need to be in a voice channel to use this command')
                  
                      # Put the rest of the code here
                  

                  這篇關(guān)于檢查用戶是否在語音頻道 discord.py的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應(yīng)命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關(guān)于我嗎?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 - 自動更改角色顏色)
                  <tfoot id='zNBvM'></tfoot>

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

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

                          1. 主站蜘蛛池模板: 久久国产高清视频 | 国产成人短视频在线观看 | 美女拍拍拍网站 | 免费国产视频在线观看 | 国产精品美女久久久久久免费 | 黄色大片观看 | 欧美一区二区三区视频 | 免费看a| 久久久国产一区 | 亚洲欧美精品一区 | 国产精品久久久久久久免费大片 | 狠狠久久 | 色噜噜狠狠色综合中国 | 日本激情视频在线播放 | 亚洲成人精品 | 不卡视频在线 | 福利二区 | h视频免费在线观看 | 美日韩中文字幕 | 成人久久 | 日韩精品在线一区二区 | 亚洲国产91| 日本电影韩国电影免费观看 | 在线中文字幕av | 国产三级日本三级 | 中文字幕在线观看第一页 | av色噜噜 | 国产精品乱码一二三区的特点 | 久久久精品国产 | 精品国产一区二区国模嫣然 | 在线男人天堂 | 久久久久国产精品午夜一区 | 国产高清精品一区二区三区 | 国产一区二区三区 | 日日骑| 成年人在线观看视频 | 欧美日韩网站 | 亚洲在线免费 | 亚洲精品99 | 玖玖国产 | 蜜臀网 |