The bot allows users to request personalized referral links. When a user joins the group using the generated link, the administrator receives a private message with the information: "username1 joined, invited by username2" (where username1 is the username of the newly joined user, and username2 is the username of the link creator).
Install the required Python package using pip:
pip install python-telegram-bot
Start the script:
python3 /path_to_bot_directory/src/bot_referral.py
The bot is designed to provide basic management of a referral link system. Follow the steps below to configure the bot:
- Group Chat ID (GROUP_CHAT_ID): Set the ID of the group chat for which invitation links are needed.
- Bot Token (BOT_TOKEN): Obtain a unique token by messaging @BotFather on Telegram. Set this token as the value of BOT_TOKEN
- Developer/Admin User ID (DEV_USER_ID): Set the administrator's ID who will receive updates privately.
In private chat, use the command /CreateLink
to obtained a personalized referral link. Share it with your friends. When a user joins the group using the link, the administrator receives a notification with the relevant information.
This is a draft. It has not been extensively tested and does not handle errors in any way.
It could integrate a database to keep track of all the links and the number of people invited by every member.