GeminiBot is a Telegram bot tailored to chat with Google's Gemini AI chatbot. Leveraging the official Gemini Bot on the Telegram platform, it engages users in dynamic conversations.
Before deploying the bot, ensure you have the following:
- Python 3.10 installed on your system
- Obtain a Telegram API token from BotFather
- Acquire a Gemini API key from the Google Gemini website
- Get your Telegram Account id from Show Json Bot. Account id is different than Account username and you should set it in
.env
file to restrict GeminiBot to your account.
BotPreview.mp4
-
Clone the repository:
git clone https://github.com/sudoAlireza/GeminiBot.git
-
Navigate to the project directory:
cd GeminiBot
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a file named
.env
in the project root and add your Telegram bot API token and Gemini API key:TELEGRAM_BOT_TOKEN=<Your Telegram Bot Token> GEMINI_API_TOKEN=<Your Gemini API key> AUTHORIZED_USER=<Your Telegram account ID number>
-
Update the
safety_settings.json
file with appropriate safety settings for Gemini policies.
Run GeminiBot using:
python main.py
- Engage in online conversations with Google's Gemini AI chatbot
- Maintain conversation history for continuing or initiating new discussions
- Send images with captions to receive responses based on the image content. For example, the bot can read text within images and convert it to text.
- Removing Specific Conversation from History
- Add Conversation Feature to Images Part
- Handle Long Responses in Multiple Messages
- Add Tests and Easy Deployment
For detailed instructions on using Telegram bots, refer to the Telegram Bots Documentation.
To begin with Gemini, refer to the Gemini API: Quickstart with Python.
Ensure the security of your API keys and sensitive information. Follow best practices for securing API keys and tokens.
Contributions to GeminiBot are encouraged. Feel free to submit issues and pull requests.