fix readiness checks

This commit is contained in:
osmarks 2020-10-30 12:26:17 +00:00
parent f0f0726998
commit 7c5c62ff40
1 changed files with 7 additions and 1 deletions

View File

@ -24,7 +24,7 @@ def setup(bot):
try:
time = util.parse_time(time)
except:
await ctx.send(embed=util.error_embed("Invalid time"))
await ctx.send(embed=util.error_embed("Invalid time (wrong format/too large/non-integer months or years)"))
return
await bot.database.execute("INSERT INTO reminders (remind_timestamp, created_timestamp, reminder, expired, extra) VALUES (?, ?, ?, ?, ?)",
(time.timestamp(), util.timestamp(), reminder, 0, util.json_encode(extra_data)))
@ -93,6 +93,12 @@ def setup(bot):
await bot.database.execute("UPDATE reminders SET expired = 1 WHERE id = ?", (expiry_id,))
await bot.database.commit()
@remind_worker.before_loop
async def before_remind_worker():
logging.info("Waiting for bot readiness...")
await bot.wait_until_ready()
logging.info("Remind worker starting")
remind_worker.start()
bot.remind_worker = remind_worker