A powerful Telegram bot repository to connect with TestBook via API to fetch & generate visually appealing HTML test files, using your authorised credentials
- Fetch test data using Testbook API.
- Support for multi-language questions (English and Hindi).
- Generates enhanced HTML files with styled question and answer content.
- Fixes image URLs dynamically for compatibility.
- Minimal dependencies and efficient performance.
- Python 3.8+
- Telethon library for interacting with Telegram.
- Internet access to fetch data and communicate with Telegram servers.
To deploy the bot on your VPS:
-
Clone the Repository:
git clone https://github.com/devgaganin/TestBook-Bot.git cd TestBook-Bot -
Install Dependencies: Ensure Python 3.8+ and
pipare installed, then run:pip install -r requirements.txt
-
Set Up Environment Variables: Create a
.envfile in the root directory or export the following variables:API_ID=your_api_id API_HASH=your_api_hash BOT_TOKEN=your_bot_token AUTH_CODE=your_auth_code # eg: eyfgobtiOtrtrUzI......eyJpc3MiHRwewczovL3Rlc3Rib.... -
Run the Bot: Start the bot using:
python main.py
To deploy the bot on Heroku, click the button below and fill in the required environment variables:
- Click the Deploy on Heroku button above.
- Enter the following required environment variables during deployment:
API_IDAPI_HASHBOT_TOKENAUTH_CODE# eg: eyfgobtiOtrtrUzI......eyJpc3MiHRwewczovL3Rlc3Rib....
- Deploy the app and monitor the logs to ensure the bot is running successfully.
| Command | Description |
|---|---|
/start |
Display a welcome message with usage instructions. |
/fetch <test_id> |
Fetch test data from the Testbook API for the provided test ID. |
/language <lang> |
Choose a language (en for English, hn for Hindi) to format test data. |
-
Start the bot:
- Type
/startin your Telegram chat with the bot. - The bot will respond with a welcome message and basic instructions.
- Type
-
Fetch a test:
- Use
/fetch <test_id>. Replace<test_id>with the specific test ID provided. - The bot will validate the test ID and retrieve the corresponding test data.
- Use
-
Select a language:
- Use
/language enfor English or/language hnfor Hindi. - The bot generates and sends an HTML file containing the test questions and answers.
- Use
-
/start
Bot: "Welcome to the Testbook Bot! Use the command/fetch <test_id>to fetch test data." -
/fetch 66fbeee4d8b88b617b0e69ab
Bot: "Test data fetched successfully! Please select a language:/language enor/language hn." -
/language en
Bot sends the test questions as an HTML file.
This project is licensed under the GNU Affero General Public License v3 (APGL-3.x).
Strict Provisions:
- No Commercial Use: This software and its derivatives must not be used for commercial purposes or sold.
- No part of this code, including edits, is allowed to be used for commercial or sale purposes.
© GitHub.com/devgaganin
Unauthorized commercial use is strictly prohibited.
The bot is intended solely for personal and educational purposes.
Use at own responsibilty and copying, modifying part of this code/reuse is not allowed.
The developer is not responsible for any misuse or breach of third-party API terms.
Hey respected representatives, If this project is engaging in any activities that you consider misleading, inappropriate, or in violation of your policies, please feel free to reach out to me immediately. I am committed to resolving any issues and will take necessary actions, including shutting down the project if required.
Contact Information: Email
Thank you for your understanding and cooperation.