enhanced schedule
This commit is contained in:
parent
8a4ef6947a
commit
6cfa3c5210
1 changed files with 4 additions and 0 deletions
|
@ -4,6 +4,7 @@ import asyncio
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from random import randrange
|
from random import randrange
|
||||||
|
from util import logging
|
||||||
|
|
||||||
def ceil_dt(dt, delta):
|
def ceil_dt(dt, delta):
|
||||||
return dt + (datetime.min - dt) % delta
|
return dt + (datetime.min - dt) % delta
|
||||||
|
@ -40,6 +41,9 @@ class Schedule(commands.Cog):
|
||||||
seconds = (date - datetime.now()).seconds
|
seconds = (date - datetime.now()).seconds
|
||||||
await self.call_event(seconds, ' '.join(name), ctx.message.author, ctx.message.channel)
|
await self.call_event(seconds, ' '.join(name), ctx.message.author, ctx.message.channel)
|
||||||
self.threads += 1
|
self.threads += 1
|
||||||
|
logging.info(f"Scheduled new event in {seconds} seconds. Current events: {self.therads}")
|
||||||
|
else:
|
||||||
|
logging.warning("Schedule: Event limit reached. Async function was not called.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue