moderator.py 文件源码

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

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def _remove_time_entry(self, guild, member, session, *, event='mute_complete'):
        query = """SELECT *
                   FROM schedule
                   WHERE event = $3
                   AND args_kwargs #>> '{args,0}' = $1
                   AND args_kwargs #>> '{args,1}' = $2
                   ORDER BY expires
                   LIMIT 1;
                """
        # We have to go to the lowest level possible, because simply using
        # session.cursor WILL NOT work, as it uses str.format to format
        # the parameters, which will throw a KeyError due to the {} in the
        # JSON operators.
        session = session.transaction.acquired_connection
        entry = await session.fetchrow(query, str(guild.id), str(member.id), event)
        if entry is None:
            return None

        await self.bot.db_scheduler.remove(discord.Object(id=entry['id']))
        return entry
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号