I wanna loop "time" untill 12:30 but print only once. How would I do this?
@client.event
async def on_ready():
reminder.start()
print("rdy")
@tasks.loop()
async def reminder():
i= 0
now = datetime.datetime.now()
start= now.replace(hour=22, minute=45, second=0, microsecond=0)
if now<start:
await client.get_channel(852950484842315786).send(f"works")
Just check the time.
@tasks.loop(seconds=60)
async def remider():
i= 0
o= 0
now = datetime.datetime.now()
start= now.replace(hour=12, minute=30, second=0, microsecond=0)
if now<start:
await client.get_channel(852950484842315786).send(f"works")
One thing is that at the end of the file you have to start the loop by
reminder.start()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.