Код: Выделить всё
Ignoring exception in command ring:
Traceback (most recent call last):
File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\max\OneDrive\Desktop\Code\DiscordBots\Nokia\Nokia.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:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\max\AppData\Roaming\Python\Python39\site-packages\discord\ext\commands\core.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'
Код: Выделить всё
@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()
Подробнее здесь: https://stackoverflow.com/questions/653 ... discord-py