def create_reminder(self, ctx, due, note):
cid = ctx.channel.id if isinstance(ctx.channel, discord.TextChannel) else ctx.author.id
await self.bot.pgpool.execute(
"""
INSERT INTO reminders
(author_id, channel_id, note, due)
VALUES ($1, $2, $3, $4)
""",
ctx.author.id, cid, note, due
)
logger.debug('Creating reminder -- due=%s note=%s cid=%d aid=%d', due, note, cid, ctx.author.id)
# we just created a reminder, we definitely have one now!
self.queue.has_item.set()
# check if it's earlier
if self.queue.current_item and self.queue.current_item['due'] > due:
logger.debug('Got a reminder that is due earlier than the current one, rebooting task!')
self.queue.reboot()
评论列表
文章目录