Phase 5: Telegram affiliate program
- docs/AFFILIATE.md: the owner's setup in Telegram (profile editor or BotFather's Mini App), commission and duration rules (raise only, end with commission 0, about 24 hours), who counts as referred, the link formats, and the no-double-rewards rule. Checked against Telegram's current pages. - Affiliate purchases go through Stars invoices inside the Mini App (createInvoiceLink and WebApp.openInvoice, from Phase 4). - /start accepts any payload; only our own rf_ (and old ref_) links set an inviter. A test sends payloads of every shape, Telegram's affiliate prefix included. - Mini App Me page: an Earn section explaining both programs, with how to join Telegram's from the bot's profile, behind AFFILIATE_ENABLED. No affiliate numbers are computed or shown. - /referral notes that Stars purchases earn through Telegram's program. - The optional MTProto CLI is left out, with the reason in the docs. - The Mini App browser test checks the Earn section in en, es and nl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2b5625e9d4
commit
d64db03f21
@@ -226,6 +226,12 @@ REFERRAL_DAILY_CAP=2000
|
||||
STARS_ENABLED=false
|
||||
STARS_PRICES=pass_day=50,pass_week=200,pass_month=600,credits_1000=70,credits_5000=330,credits_20000=1300
|
||||
|
||||
# --- Telegram's affiliate program ---------------------------------------------------
|
||||
# Explain Telegram's affiliate program in the Mini App's Earn section. Turn
|
||||
# it on after opening the program for the bot in Telegram; the bot cannot
|
||||
# do that itself. See docs/AFFILIATE.md.
|
||||
AFFILIATE_ENABLED=false
|
||||
|
||||
# --- Rate limits ------------------------------------------------------------
|
||||
# Links per minute. 0 means no limit.
|
||||
RATE_USER_PER_MINUTE=10
|
||||
|
||||
@@ -36,6 +36,10 @@ referral_daily_cap = 2000
|
||||
# sold for Stars.
|
||||
stars_enabled = false
|
||||
|
||||
# Explain Telegram's affiliate program in the Mini App (set it up in
|
||||
# Telegram first, see docs/AFFILIATE.md).
|
||||
affiliate_enabled = false
|
||||
|
||||
[telegram]
|
||||
api_url = "https://api.telegram.org"
|
||||
mode = "polling" # polling or webhook
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
# Telegram's affiliate program
|
||||
|
||||
Telegram lets the owner of a Mini App open an **affiliate program**.
|
||||
Anyone on Telegram can join it and get a link to the Mini App. When
|
||||
somebody opens the Mini App for the first time through that link and
|
||||
later spends Telegram Stars in it, Telegram pays the link's owner a share
|
||||
of those Stars, for as long as the program says. Telegram handles all of
|
||||
it: joining, links, counting and paying out.
|
||||
|
||||
The bot does not create the program and does not count affiliate
|
||||
earnings. This page is about what the owner sets up by hand, and what the
|
||||
bot does so the program works.
|
||||
|
||||
Sources, checked on 2026-11-18:
|
||||
[affiliate programs](https://core.telegram.org/api/bots/referrals),
|
||||
[referral links](https://core.telegram.org/api/links#referral-links),
|
||||
[Mini Apps](https://core.telegram.org/bots/webapps),
|
||||
[Bot API payments](https://core.telegram.org/bots/api#payments).
|
||||
|
||||
## Before you start (5 minutes)
|
||||
|
||||
Affiliates only earn on **Stars purchases made inside the Mini App**, so
|
||||
both of these must work first.
|
||||
|
||||
1. **The Mini App.** Set `MINIAPP_ENABLED=true` and an HTTPS `PUBLIC_URL`,
|
||||
and register the app in @BotFather as described in
|
||||
[OPERATIONS.md](OPERATIONS.md). Open the bot and check that the menu
|
||||
button opens the app.
|
||||
2. **Stars payments.** Set `STARS_ENABLED=true` and your prices in
|
||||
`STARS_PRICES` (or `[stars_prices]` in the config file), then restart.
|
||||
In the app, open Buy, choose Telegram Stars (the switch is there when
|
||||
Lightning is set up too) and check that a pass opens Telegram's payment
|
||||
sheet.
|
||||
|
||||
## Open the program (5 minutes)
|
||||
|
||||
Use the Telegram account that owns the bot.
|
||||
|
||||
1. Open the bot's profile in Telegram and choose **Edit**, or open
|
||||
@BotFather, start its Mini App and pick the bot.
|
||||
2. Choose **Affiliate program**. Telegram shows this option to the
|
||||
owner of a bot. If you do not see it, Telegram has not made affiliate
|
||||
programs available to your account or region yet. That is decided by
|
||||
Telegram (the `starref_program_allowed` setting), not by the bot.
|
||||
3. Pick the **commission**: the share of each Stars purchase that goes to
|
||||
the affiliate, in permille. Telegram only offers values within its
|
||||
allowed range (`starref_min_commission_permille` to
|
||||
`starref_max_commission_permille`). The range can change, so the app
|
||||
shows the current one.
|
||||
4. Optionally pick a **duration** in months: how long a referred user's
|
||||
purchases keep earning their affiliate. Without one the program has no
|
||||
end date.
|
||||
5. Confirm. The program is live.
|
||||
6. Set `AFFILIATE_ENABLED=true` and restart the bot. The Mini App's Me
|
||||
page then explains Telegram's program next to the sats referral, and
|
||||
/referral says that Stars purchases count there.
|
||||
7. Check it as an ordinary user: open the bot's profile from another
|
||||
account and look for the affiliate program.
|
||||
|
||||
Under the hood the apps call the MTProto method
|
||||
`bots.updateStarRefProgram` with the bot, `commission_permille` and an
|
||||
optional `duration_months`. This is not part of the Bot API, which is why
|
||||
the bot cannot do it for you.
|
||||
|
||||
## Rules to know before you choose
|
||||
|
||||
- **Commission and duration can only be raised.** To lower either one,
|
||||
end the program and open a new one.
|
||||
- **Ending** means setting the commission to 0. The program then ends
|
||||
about 24 hours later, at its `end_date`, and every affiliate link stops
|
||||
working. A new program can only be opened after that; trying earlier
|
||||
fails with `STARREF_AWAITING_END`.
|
||||
- After the end, affiliates keep what they earned. People they referred
|
||||
while the program ran keep earning them commission until the duration
|
||||
that was set at the time runs out.
|
||||
- **Who counts as referred:** somebody who starts the Mini App for the
|
||||
first time after following an affiliate link. Their Stars purchases of
|
||||
digital products in the Mini App then pay the affiliate automatically,
|
||||
in Stars.
|
||||
|
||||
## What the bot does
|
||||
|
||||
- **Stars invoices for the Mini App.** The Buy page creates Stars
|
||||
invoices with `createInvoiceLink` and opens them inside the app with
|
||||
`WebApp.openInvoice`. The purchase is confirmed by the
|
||||
`successful_payment` update Telegram sends to the bot, never by the
|
||||
app. Telegram's page talks about purchases "within the mini app" and
|
||||
does not say whether invoices sent in the bot chat count too. The chat
|
||||
also offers Stars, so people can pay where they are, but **for the
|
||||
affiliate program the Mini App is the way to buy**.
|
||||
- **Any /start payload is fine.** Affiliate links come in two forms:
|
||||
`https://t.me/<bot>?ref=<referrer>`, or
|
||||
`https://t.me/<bot>?start=<prefix><referrer>`, where the prefixes are
|
||||
Telegram's (`starref_start_param_prefixes`). Telegram resolves the
|
||||
referrer. The bot only receives `/start <prefix><referrer>`, which it
|
||||
answers with the normal welcome. Our own referral links start with
|
||||
`rf_` (older ones with `ref_`). Only those set an inviter for the sats
|
||||
program; any other payload is ignored for referrals. Neither program
|
||||
can get in the way of the other. A test sends every kind of payload,
|
||||
including made-up and broken ones.
|
||||
- **No double rewards.** One purchase earns one reward:
|
||||
- A **Lightning** purchase can earn the inviter our **sats reward**
|
||||
(`REFERRAL_REWARD_SATS`, once per invited user, after the first
|
||||
settled Lightning purchase).
|
||||
- A **Stars** purchase can only earn an affiliate **Telegram's
|
||||
commission**. Our sats reward ignores Stars purchases completely.
|
||||
This rule is in `billing.rewardReferrer`, and covered by
|
||||
`TestStarsPurchasesEarnNoSatsReferral`.
|
||||
- **No numbers of its own.** The Earn section explains how to join from
|
||||
the bot's profile and has a button that opens it. It never shows
|
||||
affiliate earnings: Telegram shows those to the affiliate.
|
||||
|
||||
## What Telegram's pages do not say
|
||||
|
||||
These are decided by Telegram and are not documented on the pages above.
|
||||
The bot makes no promises about them:
|
||||
|
||||
- How a user who followed several affiliate links is attributed.
|
||||
- When commissions are paid out and when affiliates can withdraw them.
|
||||
- The exact labels in each Telegram app; they can differ by version.
|
||||
|
||||
## Not included: a command-line tool for the program
|
||||
|
||||
An optional `cmd/affiliatectl` was suggested: a small MTProto tool for
|
||||
`bots.getAdminedBots` and `bots.updateStarRefProgram`. It was left out.
|
||||
It would add a large MTProto library to the module, and it needs the
|
||||
owner's own Telegram login session. Keeping that session out of the
|
||||
repository and out of the bot's runtime is easy to get wrong, and a
|
||||
mistake there exposes the owner's whole account. The official apps do the
|
||||
same job safely in a few taps, as described above.
|
||||
@@ -1135,3 +1135,38 @@ the affiliate program. What was found and planned is in
|
||||
the core, which settles it from Telegram's `successful_payment` update.
|
||||
- `pre_checkout_query` was added to the update types the bot asks
|
||||
Telegram for.
|
||||
|
||||
### Phase 5: Telegram affiliate program
|
||||
|
||||
- **The facts were checked again on Telegram's pages** (affiliate
|
||||
programs, referral links, Mini Apps) and match the brief. Two details
|
||||
were added:
|
||||
- The commission range comes from Telegram's client configuration, so
|
||||
the docs give no fixed numbers.
|
||||
- Telegram's own `/start` prefixes for affiliate links are also client
|
||||
configuration (`starref_start_param_prefixes`), so the bot does not
|
||||
try to recognize them. It treats every payload it does not own as
|
||||
"not ours".
|
||||
- **Chat invoices.** Telegram's page speaks of Stars purchases "within the
|
||||
mini app" and does not say whether invoices sent in the bot chat count.
|
||||
The Mini App's Buy page therefore creates its own Stars invoice links,
|
||||
and the docs tell owners that the Mini App is the way to buy for the
|
||||
program. The chat keeps its Stars buttons for people who are there.
|
||||
- **No double rewards.** The rule is enforced in billing
|
||||
(`rewardReferrer`): the sats reward only looks at Lightning purchases,
|
||||
and Stars purchases are left to Telegram's commission. /referral says
|
||||
so when `AFFILIATE_ENABLED` is on.
|
||||
- **The Earn section** is on the Me page. It explains both programs. The
|
||||
part about Telegram's program, with the steps to join from the bot's
|
||||
profile and a button that opens the profile, only shows with
|
||||
`AFFILIATE_ENABLED` (off by default, since the owner must open the
|
||||
program first). It shows no affiliate numbers. The step to join is
|
||||
worded generically ("tap the affiliate program"), because Telegram's
|
||||
pages do not give the exact labels of each app.
|
||||
- **The optional `cmd/affiliatectl` was skipped.** It needs a large MTProto
|
||||
dependency and the owner's personal Telegram session, which is a risk
|
||||
to the owner's account for something the official apps do in a few
|
||||
taps. The reason is in docs/AFFILIATE.md.
|
||||
- **Checked in a browser.** The Mini App browser test (headless Chromium
|
||||
against a core in test mode) checks the Earn section in English,
|
||||
Spanish and Dutch, and the new referral link format.
|
||||
|
||||
@@ -255,7 +255,7 @@ func (m *MiniApp) me(w http.ResponseWriter, r *http.Request, s *session) {
|
||||
MaxSize: dec.Limits.MaxSize, MaxDuration: dec.Limits.MaxDuration, ActiveJobs: dec.Limits.ActiveJobs,
|
||||
DailyDownloads: dec.Limits.DailyDownloads, DailyBytes: dec.Limits.DailyBytes,
|
||||
},
|
||||
"payments": m.Billing.Enabled(),
|
||||
"payments": m.Billing.Enabled(),
|
||||
"referral_link": refLink,
|
||||
"referral_count": refStats.Invited,
|
||||
"referral_converted": refStats.Converted,
|
||||
@@ -264,9 +264,13 @@ func (m *MiniApp) me(w http.ResponseWriter, r *http.Request, s *session) {
|
||||
"referral_qr": refQR,
|
||||
"referral_reward": m.Cfg.Prices.ReferralReward,
|
||||
"referral_daily_cap": m.Cfg.ReferralDailyCap,
|
||||
"support": support,
|
||||
"start_param": s.init.StartParam,
|
||||
"bot": m.Bot.Username(),
|
||||
// Telegram's affiliate program is set up and paid by Telegram; the
|
||||
// app only explains it, and shows no numbers of its own.
|
||||
"affiliate_enabled": m.Cfg.AffiliateEnabled,
|
||||
"stars_enabled": m.Billing.StarsEnabled(),
|
||||
"support": support,
|
||||
"start_param": s.init.StartParam,
|
||||
"bot": m.Bot.Username(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -605,3 +605,64 @@ func TestMenuButtonOpensTheAppInTheUsersLanguage(t *testing.T) {
|
||||
t.Fatalf("menu button after switching = %s", btn.Params["menu_button"])
|
||||
}
|
||||
}
|
||||
|
||||
// --- /start payloads of every shape ------------------------------------------
|
||||
|
||||
func TestStartPayloadsOfEveryShape(t *testing.T) {
|
||||
h := startApp(t, nil, func(c *config.Config) { c.AffiliateEnabled = true })
|
||||
h.askEveryTime(alice)
|
||||
code, err := h.app.Store.RefCode(context.Background(), alice)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
payloads := []string{
|
||||
"",
|
||||
// Telegram's affiliate links: a prefix from Telegram's client
|
||||
// configuration (starref_start_param_prefixes), then the referrer.
|
||||
"_tgr_AbCdEf123", "_tgr_", "_tgr_" + strings.Repeat("x", 58),
|
||||
// Our own links, the old ones, and broken ones.
|
||||
"rf_" + code, "rf_", "rf_zzzzzzzz", "rf_" + code + "extra", "ref_", "ref_42", "ref_-5", "ref_99999999999999999999",
|
||||
// Other deep links of the bot, valid and not.
|
||||
"buy", "buy_", "buy_nope_best", "buy_nope_x--y", "skip_", "skip_nope", "gw_", "gw_abc", "gs_-100", "gw_-100123",
|
||||
// What a person can type by hand.
|
||||
"hello world", "<b>hi</b>", "💥", strings.Repeat("A", 300), "_", "-", "ref", "rf", "start",
|
||||
}
|
||||
for i, p := range payloads {
|
||||
user := int64(5000 + i)
|
||||
seq := h.srv.Seq()
|
||||
h.srv.PushMessage(user, user, strings.TrimSpace("/start "+p))
|
||||
reply := h.wait(seq, "sendMessage", func(c fakeserver.Call) bool { return c.ChatID() == user })
|
||||
if strings.Contains(reply.Text(), "went wrong") {
|
||||
t.Errorf("payload %q: %q", p, reply.Text())
|
||||
}
|
||||
u, err := h.app.Store.GetUser(context.Background(), user)
|
||||
if err != nil {
|
||||
t.Fatalf("payload %q: %v", p, err)
|
||||
}
|
||||
// Only our own links set a referrer; Telegram's never do.
|
||||
want := int64(0)
|
||||
if p == "rf_"+code || p == "ref_42" {
|
||||
want = alice
|
||||
}
|
||||
if u.ReferredBy != want {
|
||||
t.Errorf("payload %q: referred by %d, want %d", p, u.ReferredBy, want)
|
||||
}
|
||||
}
|
||||
// In a group /start with a payload is fine too.
|
||||
h.meetGroup(alice)
|
||||
seq := h.srv.Seq()
|
||||
h.srv.PushMessage(group, alice, "/start@"+fakeserver.BotUsername+" _tgr_abc")
|
||||
h.wait(seq, "sendMessage", func(c fakeserver.Call) bool { return c.ChatID() == group })
|
||||
|
||||
// /referral says which purchases count where.
|
||||
seq = h.srv.Seq()
|
||||
h.srv.PushMessage(alice, alice, "/referral")
|
||||
ref := h.wait(seq, "sendMessage", textHas("Invite friends"))
|
||||
if !strings.Contains(ref.Text(), "Telegram Stars do not count here") {
|
||||
t.Fatalf("referral text = %q", ref.Text())
|
||||
}
|
||||
// The Mini App knows whether to explain Telegram's program.
|
||||
if me := h.must(alice, "GET", "me", nil); me.Body["affiliate_enabled"] != true {
|
||||
t.Fatalf("me = %s", me.Raw)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ func TestMiniAppStage(t *testing.T) {
|
||||
}
|
||||
h := startApp(t, &ytdlptest.Fake{FileSize: 3000, Delay: 5 * time.Second}, func(c *config.Config) {
|
||||
c.Worker.Concurrency = 1
|
||||
c.StarsEnabled = true
|
||||
c.AffiliateEnabled = true
|
||||
})
|
||||
h.meetGroup(alice, bob)
|
||||
h.fetch(bob, link) // something for the history page
|
||||
|
||||
@@ -117,7 +117,9 @@ func TestStarsPurchaseInTheChat(t *testing.T) {
|
||||
t.Fatalf("refundStarPayment = %+v", refund.Params)
|
||||
}
|
||||
h.wait(seq, "sendMessage", func(c fakeserver.Call) bool { return c.ChatID() == alice && strings.Contains(c.Text(), "refunded") })
|
||||
h.wait(seq, "sendMessage", func(c fakeserver.Call) bool { return c.ChatID() == owner && strings.Contains(c.Text(), "Refunded 200 Stars") })
|
||||
h.wait(seq, "sendMessage", func(c fakeserver.Call) bool {
|
||||
return c.ChatID() == owner && strings.Contains(c.Text(), "Refunded 200 Stars")
|
||||
})
|
||||
if st, _ := h.app.Billing.State(ctx, db.OwnerUser, alice); st.PassUntil != 0 {
|
||||
t.Fatal("the refunded pass is still active")
|
||||
}
|
||||
|
||||
@@ -305,6 +305,11 @@ func (b *Bot) referralView(ctx context.Context, act actor, back bool) (string, *
|
||||
if c := b.cfg.ReferralDailyCap; c > 0 {
|
||||
text += "\n\n" + b.tr.HTML(lang, "referral.cap", i18n.Args{"Cap": b.tr.Sats(lang, c)})
|
||||
}
|
||||
if b.cfg.AffiliateEnabled {
|
||||
// Stars purchases are rewarded by Telegram's affiliate program,
|
||||
// never by ours: one purchase, one reward.
|
||||
text += "\n\n" + b.tr.HTML(lang, "referral.affiliate_note", i18n.Args{"Bot": b.username})
|
||||
}
|
||||
rows := [][]telego.InlineKeyboardButton{
|
||||
{
|
||||
urlButton(b.tr.T(lang, "btn.share", nil), shareURL(link, b.tr.T(lang, "referral.share_text", nil))),
|
||||
|
||||
@@ -123,6 +123,11 @@ type Config struct {
|
||||
// sats. A product without a price is not offered for Stars. In the
|
||||
// environment: STARS_PRICES="pass_day=50,credits_1000=70".
|
||||
StarsPrices map[string]int64 `toml:"stars_prices"`
|
||||
// AffiliateEnabled shows the Earn section's part about Telegram's
|
||||
// affiliate program (a share of Stars spent in the Mini App, paid by
|
||||
// Telegram). Turn it on once the program is set up for the bot, see
|
||||
// docs/AFFILIATE.md.
|
||||
AffiliateEnabled bool `toml:"affiliate_enabled" env:"AFFILIATE_ENABLED"`
|
||||
}
|
||||
|
||||
// StarsPrice returns the price in Stars of a product, or false when it
|
||||
|
||||
@@ -858,6 +858,16 @@ one = "Usage, last day"
|
||||
other = "Usage, last {{.Count}} days"
|
||||
|
||||
[app.me]
|
||||
affiliate_open = "Open the bot's profile"
|
||||
affiliate_step3 = "Copy the link Telegram gives you and share it."
|
||||
affiliate_step2 = "Tap the affiliate program and join it."
|
||||
affiliate_step1 = "Open the profile of {{.Bot}} in Telegram."
|
||||
affiliate_text = "Share a Telegram affiliate link to this app. When somebody opens the app for the first time through your link, you get a share of the Stars they spend in it, for as long as the program says."
|
||||
affiliate_note = "Telegram runs this program and pays your share in Stars. You see what you earn in Telegram, not here."
|
||||
affiliate_title = "Telegram affiliate program"
|
||||
earn_note_both = "There are two ways to earn. Our own referral pays you sats when people you invite buy over Lightning. Telegram's affiliate program pays you a share of the Stars they spend in this app. A purchase counts for one of the two, never both."
|
||||
earn_note_sats = "Invite friends with your link. When somebody you invited pays for a first purchase over Lightning, you get sats in credits."
|
||||
earn_title = "Earn"
|
||||
qr = "QR code"
|
||||
pending = "Waiting for the daily cap"
|
||||
earned = "Earned"
|
||||
@@ -919,6 +929,7 @@ one = "Remove {{.Count}} download from your history? Files already in this chat
|
||||
other = "Remove all {{.Count}} downloads from your history? Files already in this chat stay where they are."
|
||||
|
||||
[referral]
|
||||
affiliate_note = "Purchases paid with Telegram Stars do not count here: they earn through Telegram's affiliate program. You join it from the profile of @{{.Bot}} in Telegram."
|
||||
qr_caption = """
|
||||
Your invite link as a QR code:
|
||||
{{.Link}}"""
|
||||
|
||||
@@ -833,6 +833,16 @@ one = "Uso, último día"
|
||||
other = "Uso, últimos {{.Count}} días"
|
||||
|
||||
[app.me]
|
||||
affiliate_open = "Abrir el perfil del bot"
|
||||
affiliate_step3 = "Copia el enlace que te da Telegram y compártelo."
|
||||
affiliate_step2 = "Toca el programa de afiliados y únete."
|
||||
affiliate_step1 = "Abre el perfil de {{.Bot}} en Telegram."
|
||||
affiliate_text = "Comparte un enlace de afiliado de Telegram a esta app. Cuando alguien abre la app por primera vez con tu enlace, recibes una parte de las Estrellas que gasta en ella, durante el tiempo que indique el programa."
|
||||
affiliate_note = "Telegram gestiona este programa y te paga tu parte en Estrellas. Lo que ganas lo ves en Telegram, no aquí."
|
||||
affiliate_title = "Programa de afiliados de Telegram"
|
||||
earn_note_both = "Hay dos formas de ganar. Nuestro programa de referidos te paga sats cuando las personas que invitas compran por Lightning. El programa de afiliados de Telegram te paga una parte de las Estrellas que gastan en esta app. Una compra cuenta para uno de los dos, nunca para ambos."
|
||||
earn_note_sats = "Invita a tus amigos con tu enlace. Cuando alguien que invitaste pague una primera compra por Lightning, recibes sats en créditos."
|
||||
earn_title = "Gana"
|
||||
qr = "Código QR"
|
||||
pending = "En espera del tope diario"
|
||||
earned = "Ganado"
|
||||
@@ -892,6 +902,7 @@ one = "Quitar {{.Count}} descarga de tu historial? Los archivos que ya están en
|
||||
other = "Quitar las {{.Count}} descargas de tu historial? Los archivos que ya están en este chat se quedan donde están."
|
||||
|
||||
[referral]
|
||||
affiliate_note = "Las compras pagadas con Estrellas de Telegram no cuentan aquí: generan ganancias con el programa de afiliados de Telegram. Te unes desde el perfil de @{{.Bot}} en Telegram."
|
||||
qr_caption = """
|
||||
Tu enlace de invitación como código QR:
|
||||
{{.Link}}"""
|
||||
|
||||
@@ -832,6 +832,16 @@ one = "Gebruik, afgelopen dag"
|
||||
other = "Gebruik, afgelopen {{.Count}} dagen"
|
||||
|
||||
[app.me]
|
||||
affiliate_open = "Profiel van de bot openen"
|
||||
affiliate_step3 = "Kopieer de link die Telegram je geeft en deel hem."
|
||||
affiliate_step2 = "Tik op het affiliateprogramma en doe mee."
|
||||
affiliate_step1 = "Open het profiel van {{.Bot}} in Telegram."
|
||||
affiliate_text = "Deel een affiliatelink van Telegram naar deze app. Als iemand de app voor het eerst via jouw link opent, krijg je een deel van de Stars die diegene erin uitgeeft, zo lang als het programma aangeeft."
|
||||
affiliate_note = "Telegram regelt dit programma en betaalt je deel uit in Stars. Wat je verdient zie je in Telegram, niet hier."
|
||||
affiliate_title = "Affiliateprogramma van Telegram"
|
||||
earn_note_both = "Er zijn twee manieren om te verdienen. Ons eigen uitnodigingsprogramma betaalt je sats als mensen die je uitnodigt via Lightning kopen. Het affiliateprogramma van Telegram betaalt je een deel van de Stars die zij in deze app uitgeven. Een aankoop telt voor een van de twee, nooit voor allebei."
|
||||
earn_note_sats = "Nodig vrienden uit met je link. Als iemand die je uitnodigde een eerste aankoop via Lightning betaalt, krijg jij sats aan tegoed."
|
||||
earn_title = "Verdienen"
|
||||
qr = "QR-code"
|
||||
pending = "Wacht op de daglimiet"
|
||||
earned = "Verdiend"
|
||||
@@ -891,6 +901,7 @@ one = "{{.Count}} download uit je geschiedenis halen? Bestanden die al in deze c
|
||||
other = "Alle {{.Count}} downloads uit je geschiedenis halen? Bestanden die al in deze chat staan blijven staan."
|
||||
|
||||
[referral]
|
||||
affiliate_note = "Aankopen die met Telegram Stars zijn betaald tellen hier niet mee: die leveren iets op via het affiliateprogramma van Telegram. Je doet mee via het profiel van @{{.Bot}} in Telegram."
|
||||
qr_caption = """
|
||||
Je uitnodigingslink als QR-code:
|
||||
{{.Link}}"""
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
||||
3c98bec15c044f90e699f7a6b50fb1e6b1bb05928f40e22039c610dcbde14a31
|
||||
234ea8b6124984bf38cb7b276a74e1b6b49c6fffc85e50a91be7d7822930d8fa
|
||||
|
||||
@@ -220,7 +220,14 @@ try {
|
||||
await page.locator('[role="switch"][aria-checked="true"]').waitFor();
|
||||
await page.getByRole("button", { name: "Copy link" }).click();
|
||||
const link = await page.evaluate(() => navigator.clipboard.readText());
|
||||
if (!/\?start=ref_\d+$/.test(link)) throw new Error("referral link = " + link);
|
||||
if (!/\?start=rf_[A-Z2-7]{8}$/.test(link)) throw new Error("referral link = " + link);
|
||||
// Both ways to earn are explained: our sats referral and Telegram's
|
||||
// affiliate program, which the app only describes.
|
||||
await page.getByText("Earn", { exact: true }).waitFor();
|
||||
await page.getByText("Telegram affiliate program", { exact: true }).waitFor();
|
||||
await page.getByRole("button", { name: "Open the bot's profile" }).click();
|
||||
const profile = await page.evaluate(() => window.__opened.at(-1));
|
||||
if (!/^https:\/\/t\.me\/[A-Za-z0-9_]+$/.test(profile || "")) throw new Error("profile link = " + profile);
|
||||
await page.getByRole("button", { name: "Share" }).click();
|
||||
const shared = await page.evaluate(() => window.__opened.at(-1));
|
||||
if (!shared.startsWith("https://t.me/share/url?url=")) throw new Error("share link = " + shared);
|
||||
@@ -230,10 +237,15 @@ try {
|
||||
await page.getByLabel("Language", { exact: true }).selectOption("es");
|
||||
await tab(page, "Inicio").waitFor();
|
||||
await page.getByText("Invita a tus amigos").waitFor();
|
||||
await page.getByText("Gana", { exact: true }).waitFor();
|
||||
await page.getByText("Programa de afiliados de Telegram", { exact: true }).waitFor();
|
||||
if ((await page.evaluate(() => document.documentElement.lang)) !== "es") throw new Error("html lang was not updated");
|
||||
await shot(page, "me-spanish");
|
||||
await page.getByLabel("Idioma", { exact: true }).selectOption("nl");
|
||||
await tab(page, "Start").waitFor();
|
||||
await page.getByText("Verdienen", { exact: true }).waitFor();
|
||||
await page.getByText("Affiliateprogramma van Telegram", { exact: true }).waitFor();
|
||||
await shot(page, "me-dutch");
|
||||
await page.getByLabel("Taal", { exact: true }).selectOption("");
|
||||
await tab(page, "Home").waitFor();
|
||||
});
|
||||
|
||||
@@ -71,6 +71,8 @@ export interface Me {
|
||||
referral_qr: string;
|
||||
referral_reward: number;
|
||||
referral_daily_cap: number;
|
||||
affiliate_enabled: boolean;
|
||||
stars_enabled: boolean;
|
||||
support: string;
|
||||
start_param: string;
|
||||
bot: string;
|
||||
|
||||
@@ -65,6 +65,10 @@ export function Profile() {
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section title={t("app.me.earn_title")}>
|
||||
<div className="pad">{t(me.affiliate_enabled ? "app.me.earn_note_both" : "app.me.earn_note_sats")}</div>
|
||||
</Section>
|
||||
|
||||
<Section
|
||||
title={t("app.me.referral_title")}
|
||||
note={me.referral_reward > 0 ? t("app.me.referral_note", { Reward: sats(me.referral_reward) }) : undefined}
|
||||
@@ -113,6 +117,24 @@ export function Profile() {
|
||||
{me.referral_pending > 0 && <Cell title={t("app.me.pending")} after={sats(me.referral_pending)} />}
|
||||
</Section>
|
||||
|
||||
{me.affiliate_enabled && (
|
||||
// Telegram runs this program and pays it out; the app explains how
|
||||
// to join and shows no earnings of its own.
|
||||
<Section title={t("app.me.affiliate_title")} note={t("app.me.affiliate_note")}>
|
||||
<div className="pad stack">
|
||||
<div>{t("app.me.affiliate_text")}</div>
|
||||
<ol className="steps-list">
|
||||
<li>{t("app.me.affiliate_step1", { Bot: "@" + me.bot })}</li>
|
||||
<li>{t("app.me.affiliate_step2")}</li>
|
||||
<li>{t("app.me.affiliate_step3")}</li>
|
||||
</ol>
|
||||
<Button wide kind="soft" onClick={() => openTelegram("https://t.me/" + me.bot)}>
|
||||
{t("app.me.affiliate_open")}
|
||||
</Button>
|
||||
</div>
|
||||
</Section>
|
||||
)}
|
||||
|
||||
<Section>
|
||||
<Cell title={t("app.history.title")} chevron onClick={() => go({ tab: "home", page: "history" })} />
|
||||
<Cell
|
||||
|
||||
@@ -489,6 +489,15 @@ button.cell:active {
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.steps-list {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.steps-list li + li {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.qr-toggle summary {
|
||||
cursor: pointer;
|
||||
color: var(--accent);
|
||||
|
||||
Reference in New Issue
Block a user