Me gustaría un estado para mi robot de Discord, un estado "jugando" estado pero no con un juego real, sé que puedes hacerlo. ¿Cómo hago eso al programar un bot de Discord en Python?
EDITAR: Tengo este código y no funciona.
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
client = discord.Client()
PREFIX = ("$")
bot = commands.Bot(command_prefix=PREFIX)
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Game(name="testing this code"))
print("Bot is ready!")
client.run(bot_token)
------------------------------------
Para cambiar la actividad de un bot necesitas usar Client.change_presence
Con su actividad kwarg, superando cualquiera de los siguientes:
discordia.juego
discord.Streaming (requiere una URL de Twitch válida, no la página principal)
discord.Activity con un ActivityType válido y un nombre
0
------------------------------------
Necesitas establecer un estado como se muestra en change_presence
@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.online, activity=discord.Game("Testing this code"))
print("Bot is ready!")
------------------------------------
# Setting Playing status
await bot.change_presence(activity=discord.Game(name="a game"))
# Setting Streaming status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url=my_twitch_url))
# Setting Listening status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
# Setting Watching status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
(gracias a NOT kar1m yt de esta publicación de quien copié esto :) )