Skip to content

Commit df3cba9

Browse files
committed
Fix handling of reactions by explicitly doing nothing with them
Probably fixed. Fingers crossed.
1 parent 28b0eac commit df3cba9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

bot.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''Telegram bot that (primarily) attempts to perform url hacks to get around paywalls'''
22

33

4-
__version__ = '2.4.0'
4+
__version__ = '2.4.1'
55

66

77
import asyncio
@@ -19,7 +19,7 @@
1919
from telegram import Update
2020
from telegram.constants import ChatAction, ParseMode
2121
from telegram.error import BadRequest
22-
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, PicklePersistence, filters
22+
from telegram.ext import Application, CommandHandler, ContextTypes, MessageHandler, MessageReactionHandler, PicklePersistence, filters
2323
from telegram.helpers import mention_html, create_deep_linked_url
2424
from tldextract import extract
2525
from urlextract import URLExtract
@@ -178,6 +178,11 @@ async def delete(message_id: int, update: Update, context: ContextTypes.DEFAULT_
178178
response_record_remove(message_id, context)
179179

180180

181+
async def ignore_reactions(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
182+
'''Intentionally catch and do nothing with reactions'''
183+
pass
184+
185+
181186
def response_record_add(incoming_id: int, response_id: int, context: ContextTypes.DEFAULT_TYPE) -> None:
182187
'''Track `message_id` of message that triggered the bot and `message_id` of the bot's response'''
183188
if response_id:
@@ -621,6 +626,9 @@ async def post_init(application: Application) -> None:
621626
application.add_handler(CommandHandler('delete', delete_message))
622627
application.add_handler(CommandHandler('export', export_urls))
623628
application.add_handler(CommandHandler('data', chat_data, filters=filters.User(user_id=LIST_OF_ADMINS)))
629+
630+
application.add_handler(MessageReactionHandler(ignore_reactions))
631+
624632
application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), incoming))
625633
application.add_handler(MessageHandler(filters.Document.TEXT, import_urls)) # filters.Caption(['/import']) &
626634

0 commit comments

Comments
 (0)