清空状态在状态=None时不起作用。

问题描述 投票:0回答:1

我正在写一个简短的命令,让我把状态设置为任何我想要的状态,但是我读了文档,没有办法清除状态。我唯一找到的是3年前的一个讨论,但没有用。

这是我的尝试。

@bot.command()
    async def statc(c):
        print(f"Works")
        await bot.change_presence(status=None)
python discord discord.py
1个回答
1
投票

根据 文件,您可以设置 status=None引用文档中的话:"如果[状态]。None那么 状况.在线 被使用。"这是默认(清除)状态。

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='>')

@bot.command()
async def stati(ctx):
    await bot.change_presence(status=discord.Status.idle)

@bot.command()
async def statc(c):
    await bot.change_presence(status=None)

bot.run('app token')
© www.soinside.com 2019 - 2024. All rights reserved.