1
votes

I was wondering if it is possible for a bot, to generate a Discord Server Link. Basically after I UnBan a discord user I want the bot to invite him back. I have not tried anything yet. I searched on google but could not find anything.

(Notes: I'm using Discord.py in it's latest version.)

1

1 Answers

0
votes

You can add the following to your Unban command to create a discord invite for that specific text channel and then send it to the user being unbanned:

# This will create the invite
invite = await ctx.channel.create_invite()
# This will send the user the invite via Private Message
# You will need to have fetched the user previously
await user.send(invite)

You might also want to check the official discord.py documentation to check the optional parameters that you can pass to the create_invite() method.

Reference of method create_invite