JungDev / django-telegrambot

Simple app for Telegram bot in Django
BSD 3-Clause "New" or "Revised" License
237 stars 88 forks source link

telegram bot doesn't catch all forwarded messages #25

Open vasilypvlasov opened 5 years ago

vasilypvlasov commented 5 years ago

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!

vasilypvlasov commented 5 years ago

So ok, after investigating I didn't find where is the trouble here, but when I changed the mode from WEBHOOK to POLLING -- it works perfectly without any errors