Note
This code was written many years ago for fun and can be not very good optimised (or written).
However, it is still can serve as PoC
Caution
Current problem: Hidden usernames
Inline feature for bot, allowing to hide message text from particular user(s)
This implementation is packed into a bot, but you can use it standalone, just copying the 2 needed functions (callback and inline handlers) and variables (spoilers dictionary)
-
Install the required library:
pip install pyTelegramBotAPI
-
Clone the repository:
git clone https://github.com/tizhproger/inline_spoiler.git cd inline_spoiler -
Insert your bot token in
spoiler_text.py:API_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN"
-
Run the bot:
python spoiler_text.py
- Type
@YourBotUsernamein message field and choose inline option - Recipient will see a "Show" button to reveal the hidden text
- Ideal for spoilers or private messages