Boost your Telegram channel's growth with this powerful, user-friendly referral bot. It generates unique referral links and accurately tracks invites while preventing self-referrals. Built using Python and PostgreSQL, this bot is easy to set up and scales effortlessly for communities of any size.
- Create unique referral links
- Track referral counts
- Prevent self-referrals
- Easy setup and configuration
-
Clone the repository:
git clone https://github.com/kevin-kidd/telegram-referral-bot.git cd telegram-referral-bot
-
Set up the configuration as described in the Configuration section.
-
Install the required packages:
make install
-
Set up the database:
make setup-db
-
Run the bot:
make run
/create
- Create a unique referral link/check
- Check the number of referrals you have/start <referral_code>
- Use a referral code to join the channel/group
This project uses environment variables for configuration. To set up your environment:
-
Copy the example environment file:
cp .env.example .env
-
Open the
.env
file and replace the placeholder values with your actual configuration:BOT_TOKEN
: Your Telegram Bot Token (get one from BotFather)CHANNEL_LINK
: The link to your Telegram channel or groupDB_HOST
: PostgreSQL database host (default: localhost)DB_PORT
: PostgreSQL database port (default: 5432)DB_NAME
: PostgreSQL database nameDB_USER
: PostgreSQL database userDB_PASSWORD
: PostgreSQL database passwordDEBUG
: Set to True for debug mode (default: False)
Make sure to keep your .env
file secure and never commit it to version control.
To set up the development environment:
- Install Docker and Docker Compose
- Run
docker-compose up --build
To run tests:
make test
To run the linter:
make lint
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.