【发布时间】:2021-09-08 17:04:53
【问题描述】:
我做了这个-
from asyncio import sleep as s
@client.command()
async def reminder(ctx, time: int, *, msg):
while True:
await s(time)
await ctx.send(f'{msg}, {ctx.author.mention}')
效果很好。 但是你能帮我发出停止提醒的命令吗? 因为一旦开始就永远不会停止。 :(
谢谢!
【问题讨论】:
-
你为什么要使用循环?
-
你不能用你代码的当前逻辑来真正停止提醒,它甚至还没有接近解决方案,你应该看看 asyncio 任务。
标签: discord discord.py