diff --git a/sql_helper/mixins/emoji_hashes.py b/sql_helper/mixins/emoji_hashes.py index 6cfda45..3df7191 100644 --- a/sql_helper/mixins/emoji_hashes.py +++ b/sql_helper/mixins/emoji_hashes.py @@ -20,6 +20,14 @@ async def get_all_emote_hashes_filtered(self, emote_hashes: List[str]) -> Set[st results = await self.cur.fetchall() return set(hash for hash, in results) + async def get_emote_ids_globally_filtered(self, emote_ids: List[int]) -> Set[int]: + await self.cur.execute( + "select emote_id from emote_ids where emote_id=ANY(%(emote_ids)s) and emote_hash in (select emote_hash from emote_hashes where filtered=true)", + parameters={"emote_ids": emote_ids}, + ) + results = await self.cur.fetchall() + return set(emote_id for emote_id, in results) + async def mark_emote_hash_filtered(self, emote_hash: str): await self.cur.execute( "INSERT INTO emote_hashes (emote_hash, filtered) VALUES (%(emote_hash)s, true)",