mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-20 00:15:50 +00:00
feat(config): resolve the bot username from BOT_USERNAME or getMe
The default sticker pack name and the lol User-Agent now follow whichever bot runs the code, so a bot account change needs no code edit. The default pack becomes miti99_by_<bot username>.
This commit is contained in:
1 parent
c18006fabc
commit
79104ef3d7
16 files changed
+198
-41
No files matched your search
@@ -34,7 +34,8 @@ Copy [`.env.example`](../.env.example) → `.env` (gitignored) and fill in.
|
||||
| `MODULES` | optional | CSV; empty = all modules, including any added later |
|
||||
| `OWNER_ID` | optional | Telegram user id for owner-only commands, the deploy DM, and the `/addsticker` pack owner. Unset = owner-only commands are denied and `/addsticker` refuses |
|
||||
| `ADMIN_IDS` | optional | CSV of Telegram user ids for admin-only commands |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; default `miti99_by_miti99bot`. See [sticker packs](sticker-packs.md) |
|
||||
| `BOT_USERNAME` | optional | the bot's Telegram username, without `@`; unset = asked from Telegram (`getMe`) once at startup. Used for the default sticker pack name and the lol User-Agent |
|
||||
| `STICKER_PACK_NAME` | optional | set `/addsticker` writes to; default `miti99_by_<bot username>`. See [sticker packs](sticker-packs.md) |
|
||||
| `LOL_PANDASCORE_TOKEN` | optional | PandaScore API token for the lol module (free tier) — secret, never logged; without it every `/lol*` fetch fails (stale cache may still serve briefly) |
|
||||
| `RENDERER_URL` | leave unset | base URL of the animation renderer; fixed by `compose.yml` to the bundled renderer (`http://renderer:3000`), so a Coolify value is ignored |
|
||||
| `LOG_LEVEL` | optional | `debug`, `info` (default), `warn`, or `error`; logs are JSON on stdout |
|
||||
|
||||
@@ -24,7 +24,7 @@ Single-shot: one message replying to the media to add. No conversation state.
|
||||
|
||||
| Env | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `STICKER_PACK_NAME` | `miti99_by_miti99bot` | The Telegram set to write to |
|
||||
| `STICKER_PACK_NAME` | `miti99_by_<bot username>` | The Telegram set to write to |
|
||||
| `OWNER_ID` | — | Must be the account that **owns** that set |
|
||||
|
||||
`OWNER_ID` is reused rather than given a sticker-specific twin because
|
||||
@@ -36,6 +36,9 @@ The caller's identity is used nowhere. That is what makes the command stateless:
|
||||
no records, no keys, no per-user locks, and no ownership checks. It is also why
|
||||
`/addsticker` needs no per-user storage.
|
||||
|
||||
The bot's username comes from `BOT_USERNAME` when set, otherwise from one
|
||||
`getMe` call at startup (retried on the first `/addsticker` if that failed).
|
||||
|
||||
`STICKER_PACK_NAME` **must end in `_by_<this bot's username>`** — Telegram
|
||||
requires that suffix on every set a bot creates, and refuses to let a bot edit
|
||||
any set it did not create. A name without the suffix therefore cannot be this
|
||||
@@ -49,7 +52,7 @@ before any download or API call:
|
||||
|
||||
**The pack creates itself on first use.** If the set does not exist, the first
|
||||
`/addsticker` creates it — owned by `OWNER_ID`, titled with the slug half of the
|
||||
name (`miti99_by_miti99bot` → *miti99*), and seeded with the sticker that
|
||||
name (`miti99_by_examplebot` → *miti99*), and seeded with the sticker that
|
||||
triggered it, because Telegram cannot create an empty set. The reply says
|
||||
*"Created the shared pack with this sticker."*
|
||||
|
||||
|
||||
Reference in new issue
Block a user