Skip to content

Commit

Permalink
Add get_emote_ids_globally_filtered
Browse files Browse the repository at this point in the history
  • Loading branch information
Blue committed Feb 26, 2024
1 parent 0d3a8ef commit 5fb559c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sql_helper/mixins/emoji_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit 5fb559c

Please sign in to comment.