Member.voice will be None, you need to check that
Below is the revised code:
@client.command() async def play(ctx): channel = ctx.author.voice if channel: await channel.channel.connect() await ctx.send('Joining voicechat.') else: await ctx.send('You have to be in a voice channel first.')
CLICK HERE to find out more related problems solutions.