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
评论列表
文章目录