title: discord.py: Leave a server
body: <p>I'm trying to make my bot leave a server when you run the command <code>leave</code>. At first, I tried to get my bot to kick itself but that didn't work, so I found here the method <code>client.leave_server</code> so I tried to use it but it's always giving the same error that Bot has no attribute leave_server. Does anyone know the right method?</p>
  <p>My code:</p>
  <pre><code>import asyncio
  import discord
  from discord.ext import commands
  
  client = commands.Bot(command_prefix=&quot;+&quot;)
  
  @client.event
  async def on_ready():
      print(&quot;Bot is ready&quot;)
  
  @client.command()
  @commands.is_owner()
  async def leave(ctx):
      await ctx.send(&quot;Leaving the server!&quot;)
      await asyncio.sleep(0.5)
      await client.leave_server()
  
  client.run(&quot;My_Token&quot;)
  </code></pre>
  <p>The error:</p>
  <pre><code>discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'leave_server'
  </code></pre>