# Assuming you are using discord.py library
import discord
# Instantiate the client
intents = discord.Intents.default()
intents.members = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print('Bot is ready.')
@client.event
async def on_message(message):
# Check if the message is a command to remove the bot
if message.content.startswith('!remove_bot'):
# Get the guild (server) the bot is in
guild = client.get_guild(message.guild.id)
# Get the bot's own member object
bot_member = guild.get_member(client.user.id)
# Remove the bot from the guild
await bot_member.kick(reason='Requested by user')
# Replace 'YOUR_BOT_TOKEN' with your actual bot token
client.run('YOUR_BOT_TOKEN')