This is a Telegram bot built with Golang that integrates with the Gemini AI API to generate responses to user messages. The bot only replies when mentioned in a group chat and supports intelligent responses based on message context.
- AI-Powered Responses: Uses the Gemini AI API for smart and contextual replies.
- Mention-Based Replies: Responds only when mentioned in group chats.
- Dynamic Context Handling: Answers based on previous messages when replying.
- Easy Deployment: Simple to run and deploy using
Makefile.
- Golang installed (
go versionto check) - Telegram Bot API Token (Create a bot)
- Gemini API Key get it here
git clone https://github.com/yourusername/telegram-ai-bot.git
cd telegram-ai-bot- Create a
.envfile with:BOT_TOKEN=your_telegram_bot_token GEMINI_API_KEY=your_gemini_api_key
go run main.go config.gomake runTo compile the bot into a binary:
make buildThe binary will be located in bin/mybot.
User: Mention the bot in a group: `@YourBot what is 2+2?`
Bot: 4
User: What is Golang?
User:@YourBot(replay on the message)
Bot: Golang is a programming language developed by Google...
Feel free to fork and submit a pull request!
MIT License
Made with ❤️ in Golang 🚀