You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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
I use
django-telegrambot
package to make anti-spam telegram bot. The mode for the bot isWEBHOOK
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
andforward_from_chat
when forwarding, yes -- we always have it, also I thought I just have some amount ofpending_update_count
, but it's 0I know your
django-telegrambot
based onpython-telegram-bot
package when I have the same code using onlypython-telegram-bot
and run it locally likepython 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!
The text was updated successfully, but these errors were encountered: