【发布时间】:2020-10-01 01:45:06
【问题描述】:
我想让我的机器人能够使用自定义循环时间循环发送消息 例如。 !remind 60s 会让机器人在 60 秒内说提醒 例如。 !remind 23s 会让机器人在 23 秒内发出提醒
我目前有这个,但它不起作用。 任何帮助将不胜感激,如果您也可以提供一个很好的例子。谢谢
@tasks.loop(seconds=timeP)
async def Reminder():
timeP = 5
channel = client.get_channel(717689495620681731)
await client.change_presence(activity=discord.Game('online'))
print('test')
await channel.send('<@&717696163574186026> here')
【问题讨论】:
-
我建议查看
asyncio特别是asyncio.create_taskdocs.python.org/3/library/asyncio.html
标签: python loops discord discord.py-rewrite