如何设置机器人的状态(不是活动,自定义状态)Python



我正在尝试做一个selfbot,我想做一个自定义状态命令,有没有办法在discord.py上做到这一点?如果有,请告诉我

我试过的代码:

import discord
from discord.ext import commands
user = commands.Bot(command_prefix="user!")
@user.event
async def on_ready():
    print("Online")
    await user.change_presence(status="Hey!")
    
user.run("BotToken")    

希望这是你正在寻找的:

@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.online, activity=discord.Activity(type=discord.ActivityType.listening, name="'en' prefix!"))
    print("Enfloo Bot is Ready and Online")

您可以更改状态以更改绿色圆圈,例如"空闲",更改活动类型以将"收听"更改为"观看"或"播放"。如果你还需要什么,请注释。

这是如何改变状态。我认为不可能把它改成一个不以"Listening to"开头的自定义名称

应该可以:

# 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"))

最新更新