如何将 discord.py 机器人状态设置为 listening/watching/etc

How to set discord.py bot status to listening/watching/etc

顺便说一句,我正在使用重写版本

这里是原版代码,rewrite好像不行

await bot.change_prescence(activity=discord.Game('sample text', type=2))

如何让机器人状态监听?

await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))

这是所有可能的活动

# "Playing"
await bot.change_presence(activity=discord.Game(name="Game"))

# "Listening to"
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="Some Song"))

# "Watching"
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="A movie"))

# "Streaming"
await bot.change_presence(activity=discord.Streaming(name="Drums on!", url="https://www.twitch.tv/the8bitdrummer"))