I use django-telegrambot package to make anti-spam telegram bot. The mode for the bot is WEBHOOK
I have some functionality to remove all forwarded messages from chat.
My code looks like:
if update.message.forward_from or update.message.forward_from_chat: bot.delete_message(chat_id=update.message.chat_id, message_id=update.message.message_id)
the code above doesn't work very well, for example when I select a few messages and send them to channel, it deletes only one(sometimes two) messages from forwarded set, sometimes it even doesn't delete if I forward one message, I checked if we always have forward_from and forward_from_chat when forwarding, yes -- we always have it, also I thought I just have some amount of pending_update_count, but it's 0
I know your django-telegrambot based on python-telegram-bot package when I have the same code using only python-telegram-bot and run it locally like python main.py it works perfect(catch and delete all forwarded messages)
Sorry if my question is not correct or is not related to your package, but maybe someone faced with such error here, or have any thinks/suggestions?
Thanks!
I use
django-telegrambotpackage to make anti-spam telegram bot. The mode for the bot isWEBHOOKI have some functionality to remove all forwarded messages from chat.
My code looks like:
if update.message.forward_from or update.message.forward_from_chat: bot.delete_message(chat_id=update.message.chat_id, message_id=update.message.message_id)the code above doesn't work very well, for example when I select a few messages and send them to channel, it deletes only one(sometimes two) messages from forwarded set, sometimes it even doesn't delete if I forward one message, I checked if we always have
forward_fromandforward_from_chatwhen forwarding, yes -- we always have it, also I thought I just have some amount ofpending_update_count, but it's 0I know your
django-telegrambotbased onpython-telegram-botpackage when I have the same code using onlypython-telegram-botand run it locally likepython main.pyit works perfect(catch and delete all forwarded messages)Sorry if my question is not correct or is not related to your package, but maybe someone faced with such error here, or have any thinks/suggestions?
Thanks!