【发布时间】:2021-06-15 13:28:27
【问题描述】:
我想一遍又一遍地播放一个文件,但我得到一个错误。这是一个错误:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'is_playing'
这是我的机器人不和谐代码:
@client.command()
async def p(ctx):
await ctx.channel.purge(limit=1)
channel = ctx.author.voice.channel
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
def repeat(guild, voice, audio):
voice.play(audio, after=lambda e: repeat(guild, voice, audio))
voice.is_playing()
if channel and not voice.is_playing():
audio = discord.FFmpegPCMAudio('audio.mp3')
voice.play(audio, after=lambda e: repeat(ctx.guild, voice, audio))
voice.is_playing()
有什么问题?
【问题讨论】:
标签: python-3.x discord discord.py