mirror of
https://github.com/osmarks/autobotrobot
synced 2025-01-09 23:20:26 +00:00
relative time in reminders for purposes
This commit is contained in:
parent
6ad622e027
commit
0ef9aaa8c3
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
import discord.ext.tasks as tasks
|
import discord.ext.tasks as tasks
|
||||||
|
|
||||||
import util
|
import util
|
||||||
@ -23,13 +23,14 @@ def setup(bot):
|
|||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
time = util.parse_time(time)
|
time = util.parse_time(time)
|
||||||
|
now = datetime.now(tz=timezone.utc)
|
||||||
except:
|
except:
|
||||||
await ctx.send(embed=util.error_embed("Invalid time (wrong format/too large/non-integer months or years)"))
|
await ctx.send(embed=util.error_embed("Invalid time (wrong format/too large/non-integer months or years)"))
|
||||||
return
|
return
|
||||||
await bot.database.execute("INSERT INTO reminders (remind_timestamp, created_timestamp, reminder, expired, extra) VALUES (?, ?, ?, ?, ?)",
|
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)))
|
(time.timestamp(), now.timestamp(), reminder, 0, util.json_encode(extra_data)))
|
||||||
await bot.database.commit()
|
await bot.database.commit()
|
||||||
await ctx.send(f"Reminder scheduled for {util.format_time(time)}.")
|
await ctx.send(f"Reminder scheduled for {util.format_time(time)} ({util.format_timedelta(now, time)}).")
|
||||||
|
|
||||||
async def send_to_channel(info, text):
|
async def send_to_channel(info, text):
|
||||||
channel = bot.get_channel(info["channel_id"])
|
channel = bot.get_channel(info["channel_id"])
|
||||||
|
Loading…
Reference in New Issue
Block a user