From 41b6b3f234dc626c5300fbaeb65c6b8d20bd5004 Mon Sep 17 00:00:00 2001 From: Minz Date: Sat, 1 Aug 2026 18:12:17 +0200 Subject: [PATCH] Remove post-reaction verification refetch Was doing an extra fetch_message per reaction to confirm the reaction stuck. Turned out to be unrelated to the earlier missing-reactions bug (that was the scan-state resume issue), so drop it to save the API calls. --- bot/config.py | 2 -- bot/reactor.py | 15 --------------- config.example.json | 3 +-- main.py | 4 ++-- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/bot/config.py b/bot/config.py index efa4b5b..b705c35 100644 --- a/bot/config.py +++ b/bot/config.py @@ -13,7 +13,6 @@ class Config: db_path: str log_level: str manual_guild_ids: List[int] = field(default_factory=list) - verify_reactions: bool = True def load_config(path: str = "config.json") -> Config: @@ -38,5 +37,4 @@ def load_config(path: str = "config.json") -> Config: db_path=data.get("db_path", "reactions.sqlite3"), log_level=data.get("log_level", "INFO"), manual_guild_ids=[int(g) for g in data.get("manual_guild_ids", [])], - verify_reactions=bool(data.get("verify_reactions", True)), ) diff --git a/bot/reactor.py b/bot/reactor.py index 0cd3f46..a46096d 100644 --- a/bot/reactor.py +++ b/bot/reactor.py @@ -26,7 +26,6 @@ async def react_to_message( emoji: str, source: str, display: Optional[StatsDisplay] = None, - verify: bool = True, ) -> bool: if message.author.id != friend_id: return False @@ -47,20 +46,6 @@ async def react_to_message( log.exception("Failed to react to message %s in channel %s", message.id, message.channel.id) return False - if verify: - try: - refetched = await message.channel.fetch_message(message.id) - confirmed = any(r.me and str(r.emoji) == emoji for r in refetched.reactions) - except discord.HTTPException: - confirmed = None # couldn't verify either way; don't block on it - - if confirmed is False: - log.warning( - "Reaction API call succeeded but is NOT visible on refetch! " - "message=%s channel=%s target=%s (%s) url=%s", - message.id, message.channel.id, target.name, target.target_type, message.jump_url, - ) - inserted = await asyncio.to_thread( storage.record_reaction, message.id, diff --git a/config.example.json b/config.example.json index be1c122..bfc13bd 100644 --- a/config.example.json +++ b/config.example.json @@ -5,6 +5,5 @@ "days_back": 10, "db_path": "reactions.sqlite3", "log_level": "INFO", - "manual_guild_ids": [], - "verify_reactions": true + "manual_guild_ids": [] } diff --git a/main.py b/main.py index 8b215d4..c860f0a 100644 --- a/main.py +++ b/main.py @@ -72,7 +72,7 @@ class ReactorClient(discord.Client): async def react_fn(message: discord.Message, target: Target) -> bool: return await react_to_message( self.storage, message, target, self.cfg.friend_id, self.cfg.emoji, - source="backlog", display=self.display, verify=self.cfg.verify_reactions, + source="backlog", display=self.display, ) for target in targets: @@ -100,7 +100,7 @@ class ReactorClient(discord.Client): return await react_to_message( self.storage, message, target, self.cfg.friend_id, self.cfg.emoji, - source="live", display=self.display, verify=self.cfg.verify_reactions, + source="live", display=self.display, )