Skip to content

Commit

Permalink
BUG FIX | duplicate reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
kanewi11 committed May 11, 2023
1 parent bd7c5f2 commit 268de14
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions reactionbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
loggers = ['info', 'error']
formatter = logging.Formatter('%(name)s %(asctime)s %(levelname)s %(message)s')

this_media_id = None

for logger_name in loggers:
logger = logging.getLogger(logger_name)
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -78,11 +80,20 @@ async def send_reaction_from_all_applications(_, message: types.Message) -> None
The answer is simple, if several sessions have the same API_ID and API_HASH,
only one of those sessions will send a response!
"""

global this_media_id

post = (message.chat.id, message.id)
if post in processed_post:
return

processed_post.append(post)

if this_media_id == message.media_group_id:
return

this_media_id = message.media_group_id

for app, _, _ in apps:
await send_reaction(app, message)

Expand Down

0 comments on commit 268de14

Please sign in to comment.