A Telegram bot that uses Google's Gemini AI to respond to text and voice messages. The bot transcribes voice messages to text using Google's Speech-to-Text API and generates responses using the Gemini AI model.
- Text Message Handling: Responds to text messages using Google's Gemini AI.
- Voice Message Handling: Converts voice messages to text and generates AI-powered responses.
- Python: The core programming language.
- python-telegram-bot: Library for interacting with the Telegram Bot API.
- Google Generative AI: For generating AI-powered responses.
- SpeechRecognition: For converting voice messages to text.
- pydub: For converting .ogg audio files to .wav.
- python-dotenv: For managing environment variables.
Before running the bot, ensure you have the following:
- Python 3.8 or higher;
- Telegram Bot Token;
- Google Gemini API Key;
- FFmpeg: Required for pydub to handle audio conversion;
Clone the repository:
https://github.com/RafaelPil/TelegramAIVoiceAssistant
cd TelegramAIVoiceAssistant
Create a .env file in the root directory and add your API keys:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
GEMINI_API_KEY=your_gemini_api_key_here
Run the following command to install the required Python packages:
pip install -r requirements.txt
Alternatively, use the provided install_dependencies.bat file (for Windows):
install_dependencies.bat
python main.py
- Start the Bot: Send /start to your bot on Telegram.
- Send a Text Message: The bot will respond using Google's Gemini AI.
- Send a Voice Message: The bot will transcribe the voice message to text and generate a response.
- This project is licensed under the MIT License.