discord.py change status to invisible

To change the status of a Discord bot to invisible using the discord.py library in Python, you can modify the status attribute of the bot's Activity object. Here's an example:

import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.presences = True
intents.typing = False

bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
    print('Bot is online')
    await bot.change_presence(status=discord.Status.invisible)

bot.run('YOUR_BOT_TOKEN')

In the above example, the change_presence() method is used to change the bot's presence. By passing status=discord.Status.invisible, the bot's status will be set to invisible.

Make sure to replace 'YOUR_BOT_TOKEN' with your actual bot token.

This code should be placed in your main Python script where you initialize and run your Discord bot.