reminders.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:dogbot 作者: slice 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号