Bot Telegram Username: @hbd_kg_bot
KGbot is a Telegram bot designed to provide various functionalities such as group management, user moderation, and even AI-based conversational abilities using Google's Gemini API. It's built with Python and utilizes the python-telegram-bot
library for interacting with the Telegram API.
-
AI-powered Chat:
- The bot responds to messages in private chats or when mentioned in group chats using AI responses powered by Google's Gemini API.
-
General Commands:
/creator
: Know about the creator of this bot./contribute
: Information on how to contribute to this bot./about
: Learn more about the bot.
-
Admin Commands:
/pin
: Pin a message in the group./delete
: Delete a message from the group./kick
: Kick a user from the group./ban
: Ban a user from the group./promote
: Promote a user to admin./demote
: Demote a user from admin./admins
: View the list of admins in the group.
-
User Information Commands:
/groupinfo
: Get group details./myinfo
: Get your user information./userinfo [username]
: Get information about a specific user.
-
Moderation Commands:
/warn [username]
: Warn a user./warnings [username]
: View the number of warnings a user has./clearwarnings [username]
: Clear all warnings for a user./mute [username]
: Mute a user./unmute [username]
: Unmute a user.
-
Poll Creation:
/poll [question] [option1, option2, option3,...]
: Create a poll with a question and options.
-
Group Event Handlers:
- Welcomes new members.
- Notifies when a member leaves.
- Python 3.8 or higher
python-telegram-bot
libraryrequests
library- A
.env
file with the following keys:TELEGRAM_TOKEN
: Your Telegram Bot API token.GEMINI_API_KEY
: Your Gemini API key for AI responses.
-
Programming Language: Python
-
Bot Framework:
- python-telegram-bot - A Python library for building Telegram bots.
-
AI Integration:
- Google Gemini API - Provides AI-powered conversational abilities for the bot.
-
Environment Management:
- Virtualenv - Used for creating isolated Python environments.
- dotenv - Loads environment variables from a
.env
file to securely store sensitive data like API keys.
-
Libraries:
- requests - A simple library for making HTTP requests, used for interacting with the Gemini API.
-
Deployment:
- Heroku or VPS - Cloud platforms for deploying and hosting the bot.
-
Version Control:
-
Logging:
- Python's built-in logging module for error tracking and activity monitoring.
-
Clone the repository:
git clone https://github.com/your-username/KGbot.git cd KGbot
-
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environent:
- On windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a .env file in the project root directory and add your keys:
TELEGRAM_TOKEN=your_telegram_bot_token GEMINI_API_KEY=your_gemini_api_key
-
Run the bot:
python main.py
We welcome contributions to improve the bot! To contribute:
-
Fork the repository by clicking the "Fork" button at the top right of the page.
-
Clone your fork to your local machine:
git clone https://github.com/your-username/KGbot.git
-
Create a new branch for your feature or bug fix:
git checkout -b feature-name
-
Make your changes and commit them:
git commit -am 'Add new feature or fix bug'
-
Push your changes to your forked repository:
git push origin feature-name
-
Open a pull request (PR) with a detailed description of the changes.
This project is licensed under the MIT License - see the LICENSE file for details.