A serverless Telegram bot for selling Free Fire Diamonds and PUBG Mobile UC to Ethiopian customers via Telebirr/CBE payment with manual admin approval.
Ported from Node.js + Telegraf โ Deno + grammY + Val Town's serverless runtime
You already have TELEGRAM_API_TOKEN set. If not:
๐ Add TELEGRAM_API_TOKEN here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=TELEGRAM_API_TOKEN
Get it from @BotFather.
Your numeric ID (get from @userinfobot):
๐ Add ADMIN_TELEGRAM_ID here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=ADMIN_TELEGRAM_ID
Replace 0 with your actual ID (e.g., 123456789).
Update these with your actual accounts:
๐ Add TELEBIRR_NUMBER here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=TELEBIRR_NUMBER
๐ Add CBE_ACCOUNT_NUMBER here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=CBE_ACCOUNT_NUMBER
๐ Add ACCOUNT_HOLDER_NAME here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=ACCOUNT_HOLDER_NAME
To auto-verify Free Fire / PUBG UIDs (optional โ defaults to manual verification):
๐ Add FREEFIRE_LOOKUP_URL here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=FREEFIRE_LOOKUP_URL
๐ Add PUBG_LOOKUP_URL here: https://www.val.town/x/abeniandela/abesha-pay-bot/environment-variables?key=PUBG_LOOKUP_URL
If you don't set these, the bot will flag UIDs as "โ ๏ธ unverified, please confirm manually" in the admin panel.
- Start โ pick language (English ๐ฌ๐ง / Amharic ๐ช๐น)
- Category โ Free Fire or PUBG
- Catalog โ add up to 2 items to cart
- Checkout โ enter UID for each game โ auto-verified or flagged for manual check
- Payment info โ payer name + phone
- Screenshot โ upload payment receipt
- Order created โ customer gets order #, can check status anytime with
/status
- Receives every order as a photo with full details: items, UIDs, total, payer name, phone
- Two buttons: โ Approve & Complete / โ Reject
- Customer receives notification (in their language) when order is completed or rejected
Val Town's SQLite (project-scoped) stores:
- users โ Telegram ID, username, language preference
- orders โ cart, UIDs, payment details, status
- sessions โ checkout state (persists across serverless invocations)
No persistent in-memory state โ all checkout progress is saved to the database so restarts don't interrupt customers.
| Node.js (original) | Val Town (Deno) |
|---|---|
| Telegraf | grammY |
better-sqlite3 (sync) | std/sqlite (async) |
Long polling (bot.launch()) | Webhook via HTTP handler |
In-memory Map for sessions | SQLite sessions table |
require() | ES modules + https:// imports |
.env file | Deno.env + Val Town UI |
- index.ts โ main HTTP handler, all Telegram callbacks, webhook setup
- catalog.ts โ Free Fire & PUBG items (prices in ETB)
- i18n.ts โ English & Amharic strings, templating
- lookupService.ts โ optional UID lookup (Free Fire / PUBG)
- db.ts โ SQLite schema + query helpers
On first request to the HTTP endpoint, the bot automatically sets the Telegram webhook to your val's URL. No manual setup needed โ just save your Telegram token and you're live.
- Set
ADMIN_TELEGRAM_IDto your numeric ID - Update
TELEBIRR_NUMBER,CBE_ACCOUNT_NUMBER,ACCOUNT_HOLDER_NAME - (Optional) Add
FREEFIRE_LOOKUP_URLandPUBG_LOOKUP_URLfor auto-verification - Test: message your bot
/startand go through the flow - Edit prices in
catalog.tsanytime (live redeployment)
- grammY โ Telegram bot framework for Deno
- Val Town SQLite
- Telegram Bot API