RadicalRhino
RadicalRhino

Reputation: 95

How to set bot's custom status with Discord.py

I've just gotten started with Discord.py, and I would like to set a custom status for it, i.e. "Watching for e/info" but am not sure how to do that. Only thing found on SO was for Discord.js.

My code:

import os
import random
from dotenv import load_dotenv

from discord.ext import commands

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')

bot = commands.Bot(command_prefix='e/')

@bot.event
async def on_ready():
    await  bot.change_presence(activity=discord.Activity 
    (type=discord.ActivityType.watching name="for e/info"))

@bot.command(name='info')
async def info(ctx):
    await ctx.send('Prefix: /e) Commands: \n    -info => Shows commands')


bot.run(TOKEN)

(I followed a tutorial for this minus the Status thing, I think I'm missing an import statement, I'm just not sure what to import.)

Upvotes: 1

Views: 6360

Answers (1)

duckboycool
duckboycool

Reputation: 2455

Using the .change_presence() method. Assuming you're using discord.Client()

await client.change_presence(activity=discord.Game(name='Watching for e/info'))

Also there's different kinds of statuses, Playing, Watching, Listening, and Streaming. So if you wanted it to use Watching, do this instead.

await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="for e/info"))

Upvotes: 3

Related Questions