A feature-rich Telegram chatbot built with Python that provides weather information, news updates, jokes, quotes, calculator functionality, and reminder services.
- 🌤️ Weather Information - Get current weather for any city
- 📰 News Updates - Latest news headlines from around the world
- 😄 Jokes & Quotes - Random jokes and inspirational quotes
- 🧮 Calculator - Simple mathematical calculations
- ⏰ Reminders - Set timed reminders for important tasks
- ⚙️ Settings - Customizable bot preferences
- 📱 Inline Keyboard - Easy-to-use button interface
- 🌍 Multi-language Support - Ready for internationalization
- Python 3.8 or higher
- Telegram account
- Internet connection
-
Clone or download the project files
# If you have git installed git clone <your-repository-url> cd IEMT302
-
Install required dependencies
pip install -r requirements.txt
-
Set up your Telegram Bot
- Open Telegram and search for
@BotFather - Send
/newbotcommand - Follow the instructions to create your bot
- Copy the bot token provided
- Open Telegram and search for
-
Configure environment variables
- Copy
env_example.txtto.env - Fill in your bot token and optional API keys:
BOT_TOKEN=your_actual_bot_token_here BOT_USERNAME=your_bot_username
- Copy
-
Run the bot
python bot.py
- BOT_TOKEN: Your Telegram bot token from @BotFather
- WEATHER_API_KEY: OpenWeatherMap API key for weather features
- Get free API key from OpenWeatherMap
- NEWS_API_KEY: News API key for news features
- Get free API key from NewsAPI
- BOT_USERNAME: Your bot's username (without @)
| Command | Description | Example |
|---|---|---|
/start |
Start the bot and get welcome message | /start |
/help |
Show all available commands | /help |
/weather |
Get weather for a city | /weather London |
/news |
Get latest news headlines | /news |
/joke |
Get a random joke | /joke |
/quote |
Get an inspirational quote | /quote |
/calculator |
Perform calculations | /calculator 2 + 3 * 4 |
/reminder |
Set a timed reminder | /reminder 30m Buy groceries |
/about |
Bot information | /about |
/settings |
Bot settings | /settings |
/weather New York
Returns current weather conditions for New York.
/calculator (15 + 25) * 2
Performs mathematical calculations safely.
/reminder 2h Call mom
Sets a reminder to "Call mom" in 2 hours.
IEMT302/
├── bot.py # Main bot application
├── handlers.py # Message and command handlers
├── config.py # Configuration and constants
├── requirements.txt # Python dependencies
├── env_example.txt # Environment variables template
└── README.md # This file
- Input Validation: All user inputs are validated before processing
- Safe Calculator: Mathematical expressions are restricted to basic operations
- Error Handling: Comprehensive error handling and logging
- Rate Limiting: Built-in protection against spam
python bot.py- Heroku: Deploy as a web app
- VPS: Run on a virtual private server
- Docker: Containerize the application
- Cloud Functions: Serverless deployment
Test your bot by:
- Starting the bot locally
- Opening Telegram
- Finding your bot by username
- Sending
/startcommand - Testing various features
- Add command handler in
handlers.py - Register handler in
bot.py - Update
config.pywith command description - Add to help menu
- Edit message templates in
config.py - Modify handler logic in
handlers.py - Add new inline keyboard options
- Add new API keys to
config.py - Create new handler methods in
handlers.py - Update requirements.txt if needed
The bot includes comprehensive logging:
- User interactions
- Command usage
- Error tracking
- Performance metrics
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
If you encounter issues:
- Check the logs for error messages
- Verify your bot token is correct
- Ensure all dependencies are installed
- Check your internet connection
- Verify API keys (if using weather/news features)
- Database integration for user preferences
- Multi-language support
- Advanced AI features
- Image generation capabilities
- Voice message support
- Group management features
- Analytics dashboard
Happy Botting! 🤖✨