Skip to content

Telegram bot MVP to control paid subscriptions to a private channel

Notifications You must be signed in to change notification settings

iomyaki/paid-sub-tg-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

paid-sub-tg-bot

This is a MVP of a Telegram bot that receives payments in exchange for the invitation link to a private Telegram channel.

Stack: asyncio, aiogram, SQLite, AsyncIOScheduler.

Work in direct messages:

  • upon receiving the /start command, the bot sends a welcome message;
  • the welcome message includes a button for proceeding to payment ("Subscribe" button).

Payment process:

  • after the user has made the payment, the bot receives a notification from the payment provider about the successful payment;
  • upon receiving such a notification, the bot automatically creates a subscription (as a database entry) and notifies the user about it;
  • after the subscription is created, a unique link for subscribing to the channel with a limit of 1 user is generated;
  • the created link is sent to the user after payment;
  • administrators of the private channel receive a notification that this user has made the payment and received an invitation link.

Background tasks:

  • the only background task of the bot is to check subscriptions and remind users about expiring subscriptions;
  • every day at 9:00 AM, a background task to check subscriptions is executed;
  • if there are less than 3 days left until the subscription expires, the bot sends the user a reminder;
  • if the subscription has expired, it is marked as inactive (removing an entry from a database), and the user is removed from the channel;
  • administrators of the private channel receive a notification that this user has been removed from the channel.