discord.py - Discord.py 静态定时器
问题描述
我如何有一个静态计时器,用户可以只说 ??abc 并且机器人从让我们说 300 秒开始倒计时 我希望机器人编辑相同的 mssg 而不是发送多个 mssg 谢谢
解决方案
@client.command(help="Countdown from specified seconds!")
async def countdown(ctx, t: int):
msg = await ctx.send(f'Counting down from {t}!')
while t > 0:
t -=1
await msg.edit(content=f'{t} seconds remaining')
await asyncio.sleep(1)
await ctx.send(f'Countdown end reached! {ctx.message.author.mention}')
明白这一切意味着什么,不想喂任何人;)。总帐
推荐阅读
- google-cloud-platform - GCP - 使用应用程序默认凭据的云功能域范围委派(无 -jwt)
- ios - 将数据从 VC 发送到单元而无需转换
- mysql - 如何在 Hyper-V 上运行的 Ubuntu 18.04 上提高 MariaDB 性能?
- c++ - CMake 配置在 Linux 上找不到 Qt5
- c - 多线程文件搜索
- excel - 在 VBA 中创建类的实例的函数
- flutter - 应用程序在使用颤振构建发布 apk 时停止工作,但在 razorpay 网关打开时在模拟器中工作
- typescript - 打字稿:参数顺序会影响类型推断吗?
- java - Docker 中的 Keycloak 日志文件
- android - OnClickListener 在 RecyclerView 的某些地方不起作用