Skip to content
Advertisement

Discord.py REWRITE – How to make a Guild Invite

I am trying to make my bot create an invite

invite = await bot.create_invite()

This gives an error 'bot' object has no Attribute 'create_invite'
I am using the Discord.py Rewrite.

Thanks in advance!

Advertisement

Answer

You’ll need to specify what you’re making the invite for, because the bot doesn’t currently have a target for the invite:

@bot.command()
async def createinv(ctx):
    invite = ctx.channel.create_invite()
    await ctx.send(f"Here's your invite: {invite}")

References:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement