RENZZY / Menu
Back to all work

Telegram bot / Demo project

ClubGate

A bot that grants and renews access to a private Telegram community, sends expiry reminders and handles refunds.

  • Python
  • aiogram
  • Telegram Bot API
  • PostgreSQL
  • SQLAlchemy
  • Docker Compose
ClubGate local demo terminal showing the scenario result.

The challenge

A private club needs to know who has paid and when access expires. If a payment event arrives twice or Telegram times out, the bot needs to preserve the member’s entitlement and verify the operation’s outcome.

The solution

A one-off Telegram Stars purchase grants 30 days of access. The bot issues a personal invitation, checks entitlement on join and sends an expiry reminder. Renewals add a new period. A refund revokes only the period attached to that purchase.

How it works

The outcome

The implementation report records 88 passing tests. The local scenario verified two test purchases, two access periods, one refund and membership removal at expiry. The demo simulates Telegram. A real community and real payments were outside the verification.

My contribution

I modeled payments, entitlements and actual membership separately. PostgreSQL persists events and jobs, so duplicate delivery cannot add an extra access period and the bot reconciles the remote state after a timeout.

Architecture

PostgreSQL connects incoming events, access entitlements and external actions.

Component description

Event intake

The bot or demo scenario stores incoming events before processing.

Component connections
  • Event intake: The bot or demo scenario stores incoming events before processing.
  • Payments and access: Business logic verifies an order and records a separate access period.
  • Worker: A background process runs actions through the Telegram adapter and reconciles ambiguous outcomes.
  • Event intake → Payments and access
  • Payments and access → Worker

The next step

Something in mind? Let’s make it work.

Get in touchBack to all work