|
1 | 1 | '''Telegram bot that (primarily) attempts to perform url hacks to get around paywalls''' |
2 | 2 |
|
3 | 3 |
|
4 | | -__version__ = '2.4.0' |
| 4 | +__version__ = '2.4.1' |
5 | 5 |
|
6 | 6 |
|
7 | 7 | import asyncio |
|
19 | 19 | from telegram import Update |
20 | 20 | from telegram.constants import ChatAction, ParseMode |
21 | 21 | 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 |
23 | 23 | from telegram.helpers import mention_html, create_deep_linked_url |
24 | 24 | from tldextract import extract |
25 | 25 | from urlextract import URLExtract |
@@ -178,6 +178,11 @@ async def delete(message_id: int, update: Update, context: ContextTypes.DEFAULT_ |
178 | 178 | response_record_remove(message_id, context) |
179 | 179 |
|
180 | 180 |
|
| 181 | +async def ignore_reactions(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: |
| 182 | + '''Intentionally catch and do nothing with reactions''' |
| 183 | + pass |
| 184 | + |
| 185 | + |
181 | 186 | def response_record_add(incoming_id: int, response_id: int, context: ContextTypes.DEFAULT_TYPE) -> None: |
182 | 187 | '''Track `message_id` of message that triggered the bot and `message_id` of the bot's response''' |
183 | 188 | if response_id: |
@@ -621,6 +626,9 @@ async def post_init(application: Application) -> None: |
621 | 626 | application.add_handler(CommandHandler('delete', delete_message)) |
622 | 627 | application.add_handler(CommandHandler('export', export_urls)) |
623 | 628 | application.add_handler(CommandHandler('data', chat_data, filters=filters.User(user_id=LIST_OF_ADMINS))) |
| 629 | + |
| 630 | + application.add_handler(MessageReactionHandler(ignore_reactions)) |
| 631 | + |
624 | 632 | application.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), incoming)) |
625 | 633 | application.add_handler(MessageHandler(filters.Document.TEXT, import_urls)) # filters.Caption(['/import']) & |
626 | 634 |
|
|
0 commit comments