【发布时间】:2023-02-22 07:31:52
【问题描述】:
我是 discord.ext 库,使用 @bot.tree.command 装饰器。我发现如果我只使用 @bot.command 装饰器,那么命令不会同步 on_ready。我已经为命令本身添加了描述,但我想为它接受的可选参数添加描述。代码如下。
@client.tree.command(name="command", description="test command")
async def scores(interaction: discord.Interaction, date: str=datetime.now(tz).strftime('%Y-%m-%d')):
await interaction.response.send_message(str("\n".join(testcommand.getinfo(date))))
我看到 this post 展示了如何做到这一点,但它只适用于 @bot.command 装饰器。用@bot.tree.command 尝试失败。
【问题讨论】:
标签: discord