This is a simple Python script that acts as a Telegram bot and saves received messages in a text file. The bot can be run with a graphical interface, a terminal interface, or both, depending on the user's preference.
- Receive messages from Telegram users.
- Display received messages in a graphical interface (optional).
- Print received messages in the terminal (optional).
- Save received messages in a text file ("messages.txt").
- Python 3
python-telegram-botlibrary (install withpip install python-telegram-bot)tkinterlibrary (required for the graphical interface)
-
Clone the repository or download the script file.
-
Install the required libraries if not already installed:
pip install python-telegram-bot
-
Replace
'token'with your actual bot token in the script. -
Run the script:
python3 app.py
-
Choose the desired interface option when prompted:
- Enter
1for the graphical interface. - Enter
2for the terminal interface. - Enter
3for both graphical and terminal interfaces.
- Enter
-
Interact with the Telegram bot by sending messages.
-
Received messages will be displayed in the chosen interface(s) and saved in the "messages.txt" file.
-
To stop the bot, press Ctrl+C in the terminal or close the graphical interface window.
This project is licensed under the MIT License.
Feel free to modify and adapt the code according to your needs.