I'm learning how to create a discord bot using python and I'm having trouble with this one command. What I'm trying to do is kick a specific user and then dm them a invite back to the discord server using the bot. It is a silly idea but I really want to make it work.
I specifically am having trouble with is how to kick a specific user (with user ID) and then DM that user.
Thanks!
Here the code:
if message.content == '!kickjohn':
if "527290609166188554" in [role.id for role in message.author.roles]:
<KICK JOHN COMMAND>
await client.send_message(message.channel, "_**Bye Bye John!**_")
await client.send_message(<JOHN>, 'https://discord.gg/XXXXXXX')
else:
await client.send_message(message.channel, "sorry you can't do that")
The goal of this is that if someone of the appropriate role types !kickjohn a specific discord user id (john) gets kicked and the bot automatically dm's john an invite to the server.