A powerful, feature-packed Telegram bot built using Python with asynchronous programming style. Contactgram helps you manage contacts and automate tasks with ease!
- Easy-to-use yet highly customizable Telegram bot.
- Admin management with the ability to set multiple admins.
- Fully asynchronous and designed for scalability.
- Autoconfiguration of bot commands, description, and settings during deployment.
- Support for detailed message forwarding to admins for better tracking.
- Customizable welcome message with an image.
- Mark as Seen button: Notifies users that their message has been seen.
- Instant message transfer system: Sends messages to admins or users with minimal delay.
- Reply Mode: Toggle between sending normal messages and replying directly to user messages.
- Forward Mode: Allows admins to forward messages directly to users when they forward a message to the bot.
Below is the list of available commands for the Contactgram bot:
/start: Start the bot and initialize the interaction./help: Get detailed help and instructions on how to use the bot./togglereply: Toggle between sending normal messages and sending replies to the user's messages. [Only for admin team]/forwardmode: Instead of sending messages directly to users, forward messages when an admin forwards a message to the bot. Usage:/forwardmode <user tg id>. Example:/forwardmode 123456789. Also admins can active this mode using reply to a user message. [Only for admin team]
This is where all the core configuration for the bot is stored. Below is the list of available settings:
| Setting | Description |
|---|---|
BOT_TOKEN |
Bot token from BotFather |
ADMIN_TEAM |
List of Telegram user IDs for admins, separated by commas |
MONGO_URI |
URI for MongoDB connection |
TIMEZONE |
Admin's timezone (use Asia/Colombo format) |
AUTO_CONFIG |
Set to 'True' for auto configuration during bot deployment |
BOT_NAME |
Name of the bot used for auto configuration |
BOT_DESCRIPTION |
Description for the bot for auto configuration |
BOT_SHORT_DESCRIPTION |
Short description for the bot during auto configuration |
SET_BOT_CMD |
Set to True if you want to auto set bot commands during configuration |
ENABLE_DETAILED_FORWARD |
Set to True to enable forwarding messages to admins instead of simple forwarding. |
WELCOME_MESSAGE |
Message that users will see when they start the bot with /start |
WELCOME_IMAGE_URL |
Optional image URL that will be sent along with the welcome message |
START_WEB_APP |
Start the web interface. If this not set to True you cannot use /openwebapp cmd |
QUART_SECRET_KEY |
This is like your web app password. Any String allowed. More randomness = More Secure. Do not use $ symbol |
WEB_APP_PORT |
Port number of web interface. (Recommended to not to change) |
SAVE_MESSAGES |
Save messages to mongodb to see in web interface. Set to True |
INTERFACE_ACCESS_PASSWORD |
Admin password to access web app. Any String. More randomness = More Secure. Do not use $ symbol |
ENABLE_CMD_LOGS |
If set to True all bot cmd usage (Both admin and user) will be saved to mongodb can be see in web interface. |
ENABLE_BUTTON_CLICK_LOGS |
If set to True all user and admin inline button clicks will be saved to mongodb and can be see in web interface. |
WEB_APP_URL |
Your domain or server ip. If using a domain see Nginx Configuration. Example Values: (https://contactgram.com or http://52.168.45.24) |
To use the web interface with a domain, you need to set up Nginx with the following configuration:
sudo apt update
sudo apt install nginx -ysudo systemctl start nginx
sudo systemctl enable nginxTo check if Nginx is running:
sudo systemctl status nginx- Copy the
contactgram.nginxfile in assets folder in this repo to/etc/nginx/sites-available/directory on your server. - Replace the
your-domain.comwith your domain (No https://, http://, or www. prefix. Just the domain name like contactgram.com) - Run the following command to create a symbolic link:
sudo ln -s /etc/nginx/sites-available/contactgram.nginx /etc/nginx/sites-enabled/- Test Nginx configuration using this cmd:
sudo nginx -t- If you see output like
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
- You are good to go. Restart Nginx using this cmd:
sudo systemctl restart nginx- Good Job! You can now access the web interface at your-domain.com
-
Give a Star:
Don't forget to show your support by giving a β to the repository:
Star Contactgram on GitHub -
Clone the repository:
git clone https://github.com/your-repository/Contactgram.git cd Contactgram -
Rename the settings file:
- Rename
sample_settings.envtosettings.env:
mv sample_settings.env settings.env
- Rename
-
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate # On Windows use 'venv\Scripts\activate'
-
Install dependencies:
pip install -r requirements.txt
-
Run the bot:
python3 bot.py
- Contactgram Version: 1.5.0
Check out the Contactgram bot in action here:
If you need any assistance or want to contribute to the project, feel free to reach out:
- Telegram - Contactgram
- Telegram - MrUnknown114
- Email: caveoftheseekers@gmail.com
- Channel - Master Torrenz Updates
Contributors are always welcome! Feel free to fork the project, improve upon it, and send pull requests. Together, we can make Contactgram even better.
Make your bot even more personal by customizing the Welcome Message and Welcome Image. Hereβs how it looks when you customize the settings:
-
Welcome Message:
"Welcome to Contactgram! We're glad to have you. How can I assist you today?" -
Welcome Image:
Upload your custom welcome image via any online image service or use the URL of the image you prefer.
Make sure to follow the updates and contribute to the Contactgram project. Join the community, provide feedback, and be a part of the future of Contactgram!