実現したいこと
BOTをVoice Channelから切断
[現在は Join Commandのみ完成]
発生している問題・エラーメッセージ
Ignoring exception in command stop: Traceback (most recent call last): File "C:\Users\T\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 61, in wrapped ret = await coro(*args, **kwargs) File "C:\Users\T\Desktop\Blockgrass-bot-master\command\music.py", line 36, in stop vc_client.stop() AttributeError: 'NoneType' object has no attribute 'stop' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\T\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 899, in invoke await ctx.command.invoke(ctx) File "C:\Users\T\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 614, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users\T\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 70, in wrapped raise CommandInvokeError(e) from e discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'stop'
該当のソースコード
python
1 @commands.command(name='stop') 2 async def stop(self, ctx): 3 vc_client = ctx.voice_client 4 vc_channel = ctx.author.voice.channel 5 if vc_channel: 6 vc_client.stop() 7 await ctx.send('BOTをVCから切断したよ') 8 if not vc_channel: 9 await ctx.send('Voice ChannelにBOTはいないよ')
試したこと
Voice Channelに参加してもErrorが
[Error内容は 同じ NoneType]
Discord.py/Python Ver
discord.py[1.0.0a] rewrite
python 3.7.1
エラー発生行などが分かるようにTraceback全文を追記くださると回答得られやすくなります。
回答1件
あなたの回答
tips
プレビュー