2024-06-25 23:37:58 发布
网友
所以,如果我有这么长的命令:
@bot.command(pass_context=True) async def longCommand(ctx): #typing status sleep(10) bot.say("Done!")
很遗憾,在文档或这里没有找到任何东西。在
@bot.command(pass_context=True) async def longCommand(ctx): await bot.send_typing(ctx.channel) await asyncio.sleep(10) await bot.say("Done!")
记住在每次对协程的异步调用中使用await。在
await
如果您使用重写分支,那么所有Messageable都有一个^{}上下文管理器,它允许您无限期地输入,还有一个^{}协同程序,它显示键入消息几秒钟。在
Messageable
@bot.command() async def longCommand(ctx): async with ctx.typing(): await sleep(10) await ctx.send("Done!")
记住在每次对协程的异步调用中使用
await
。在如果您使用重写分支,那么所有} 上下文管理器,它允许您无限期地输入,还有一个^{} 协同程序,它显示键入消息几秒钟。在
Messageable
都有一个^{相关问题 更多 >
编程相关推荐