I want my discord bot to create an invite link to join the voice channel that the person who called the command is in.
@client.command()
async def voiceinvite(ctx):
if ctx.author.voice:
await ctx.send(ctx.message.author.voice.create_invite(max_age=120, max_uses=10))
else:
await ctx.send("Join a voice channel")
I've tried this but there's an error about references.