title: Discord.py Bot Kick/DM Command
body: <p>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.</p>
  
  <p>I specifically am having trouble with is how to kick a specific user (with user ID) and then DM that user.</p>
  
  <p>Thanks!</p>
  
  <p>Here the code:</p>
  
  <pre><code>if message.content == '!kickjohn':
      if "527290609166188554" in [role.id for role in message.author.roles]:
          &lt;KICK JOHN COMMAND&gt;
          await client.send_message(message.channel, "_**Bye Bye John!**_")
          await client.send_message(&lt;JOHN&gt;, 'https://discord.gg/XXXXXXX')
      else:
          await client.send_message(message.channel, "sorry you can't do that")
  </code></pre>
  
  <p>The goal of this is that if someone of the appropriate role types <code>!kickjohn</code> a specific discord user id (<code>john</code>) gets kicked and the bot automatically dm's john an invite to the server.</p>