这对我来说可能很难,但我相信具有堆栈溢出功能
我想将机器人状态从播放更改为观看。我尝试了这个,但是它仍然处于播放状态。
代码:
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
PREFIX = ("$")
bot = commands.Bot(command_prefix=PREFIX, description='Hi')
@bot.event
async def on_ready():
activity = discord.Game(name="Netflix", type=3)
await bot.change_presence(status=discord.Status.idle, activity=activity)
print("Bot is ready!")
bot.run('TOKEN')
最佳答案
您可以使用此Ezz!
# 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"))
关于python - 如何更改discord.py机器人事件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/59126137/