Discord.py:如何在Discord机器人上设置状态?

时间:2020-04-11 14:41:36

标签: python discord.py

到目前为止,我可能想将#s放在哪里。当然,在您的答案中,请选择其他位置。

顶部被切断:

@client.event
async def on_ready():
    print('Bot is open {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return

   #status thing here?
    if message.content.startswith('gf!ami'):
        await message.channel.send('Hello!')
    if message.content.startswith('gf!help'):
        await message.channel.send(h)
    if message.content.startswith('gf!SEhelp'):
        await message.channel.send(sh)
    if message.content.startswith('gf!music'):
        await message.channel.send
        ("https://open.spotify.com/playlist/49ddWzhNmWxyMuYlvu8L5Z?si=jYlh6zK9RryKSeMlvKZ3yA")
    if message.content.startswith('gf!d6'):
        await message.channel.send(d6())
    if message.content.startswith('gf!cl'):
        await message.channel.send(cl)
    #Status thing here?
client.run('bot token')

1 个答案:

答案 0 :(得分:0)

查看文档以更新状态https://discordpy.readthedocs.io/en/v0.16.12/api.html#discord.Client.change_presence

例如,您应该执行以下操作:

await client.change_presence(game=discord.Game(type=1, url="https://www.twitch.tv/tomori_bot", name="Follow me on twitch ^_^"))

您可以在此处看到完整的示例:https://github.com/TomoriBot/Tomori/blob/master/tomori.pystatuses()功能上