Search code examples
pythontelegramtelegram-botpython-telegram-bottelegram-api

Python Telegram Bot: show message history for new group members


With a python based telegram bot that should help to setup group settings I want to hide/unhide the message history for new group subscribers. I am using the python-telegram-bot API wrapper (documented here).

For setting other permissions there is a method Bot.set_chat_permissions(). But for hide/unhide message history I found no method.

However, in the telegram API documentation there is an endpoint channels.togglePreHistoryHidden, that should do exactly what I want. But I could not figure out how to use that via python-telegram-bot.

Another user has asked a similar question, but related to telethon.

Any hints are appreciated.


Solution

  • python-telegram-bot is a wrapper for the Bot API. Only those methods listed in the API docs have a counterpart in python-telegram-bot. The togglePreHistoryHidden method is an endpoint of the Telegram API != Bot API.


    Disclaimer: I'm currently the maintainer of python-telegram-bot.