【发布时间】:2020-10-15 10:26:52
【问题描述】:
当用户键入命令时,如何发送正常消息?我试过使用@client.command 异步def ping 但它不起作用D:
【问题讨论】:
标签: discord.py discord.py-rewrite
当用户键入命令时,如何发送正常消息?我试过使用@client.command 异步def ping 但它不起作用D:
【问题讨论】:
标签: discord.py discord.py-rewrite
这里ctx 是上下文,hi 是命令
代码:
@client.command
async def hi(ctx):
await ctx.send("Message which you want to send")
【讨论】:
如果有帮助,请将此作为指南
@client.command
async def ping(ctx):
await ctx.send("Your message")
【讨论】:
您可以使用await ctx.send("Your message here"),确保您在@client.command 中传递了上下文。
如果你还有问题,请随时问我:)
【讨论】: