Commit Graph
100 Commits
Author SHA1 Message Date
tiennm99 512b9fc995 docs(env): drop renamed-from notes in .env.example 2026-10-08 10:35:21 +07:00
tiennm99 5e96490254 refactor: remove completed one-time startup migrations
Production data is migrated and every marker is recorded in the system
collection, so the stock dividend-history, sticker legacy-pack and stats
stock_dividend migrations no longer do anything. Stats keeps its startup
index creation and still hides retired stock_dividend rows.
2026-10-08 10:35:21 +07:00
tiennm99 5344111787 fix(dispatcher): ignore commands addressed to another bot
The matcher stripped any @suffix without checking it, so in groups where
the bot sees every message (privacy mode off, or admin rights) it answered
/cmd@otherbot as if it were /cmd. The suffix must now name this bot,
compared case-insensitively. When the username is unknown because startup
getMe failed, any suffix is still accepted so group commands keep working.
2026-10-07 16:58:47 +07:00
tiennm99 cc9080c72e chore: remove the plans directory
Finished plans, journals and reports stay in git history.
2026-10-07 16:40:24 +07:00
tiennm99 be46d4c19c docs(plans): record the tiennm99bot rebrand plan and cutover 2026-10-07 16:22:32 +07:00
tiennm99 f0ca083421 docs(loldle): note sticker file_ids carry across bot accounts 2026-10-07 16:22:31 +07:00
tiennm99 7008a57cf5 refactor!: rebrand miti99bot to tiennm99bot
BREAKING CHANGE: the Go module path is now github.com/tiennm99/tiennm99bot,
the default sticker pack is stickers_by_<bot username>, and the health body,
deploy DM, User-Agents and image names say tiennm99bot.
2026-10-07 15:14:02 +07:00
tiennm99 79104ef3d7 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>.
2026-10-07 15:08:08 +07:00
tiennm99 c18006fabc fix(renderer): raise the default render timeout to 30s
Under normal load on the shared host, a /wheelofnames GIF takes 11-12s
and a /gacha wish 14-15s to render, so the 15s default turned ordinary
renders into 504s. The default is now 30s, and the bot waits 45s so it
never abandons a render the renderer is still allowed to finish.
2026-10-03 13:06:04 +07:00
tiennm99 1c64b44a46 chore(deploy): comment out optional compose variables
Coolify passes every dashboard variable to each service through its
generated .env, so optional values need no compose reference. It also
creates a dashboard entry for every referenced variable and keeps an
existing empty entry over a ${VAR:-default}, which overrides the compose
default. Optional variables are therefore commented-out ${VAR:-default}
lines, and the code supplies their defaults.
2026-10-03 12:46:11 +07:00
tiennm99 e418bf3390 revert: restore code fallbacks for config defaults
This reverts commit 153fc21. With no fallback in code, the deploy
crash-looped: Coolify keeps an entry for every variable compose.yml has
referenced, and empty entries appear to reach the containers as empty
values instead of the compose defaults.
2026-10-03 12:42:16 +07:00
tiennm99 153fc211cf refactor!: move every config default into compose.yml
compose.yml now holds each default as ${VAR:-default}, and the code keeps
no fallback values. The bot stops at startup on a missing or invalid
PORT or LOG_LEVEL, /addsticker refuses without STICKER_PACK_NAME, and the
renderer refuses to start until every RENDERER_* setting is a valid
value, listing each problem. Settings whose empty value means none or
all (MODULES, OWNER_ID, ADMIN_IDS, the API tokens) use ${VAR:-}.

The renderer's npm start and dev load .env when present, so a local run
works from a copy of .env.example.

BREAKING CHANGE: running outside compose now requires LOG_LEVEL and PORT
for the bot, STICKER_PACK_NAME for /addsticker, and every RENDERER_*
variable for the renderer.
2026-10-03 12:38:39 +07:00
tiennm99 4f8c01dae7 chore(deploy): write compose env defaults as "default: value" 2026-10-03 12:26:41 +07:00
tiennm99 be7ad347bd chore(deploy): group compose env vars and list optional ones without defaults
Each service's environment is grouped into required, optional, and
stack-fixed values. Optional variables are referenced without a default,
so Coolify lists them as settings that can be filled in or left empty;
an empty value falls back to the code's default.
2026-10-03 12:24:16 +07:00
tiennm99 9457baf81a fix(deploy): pass LOL_PANDASCORE_TOKEN to the bot explicitly
The lol module reads the PandaScore token, but compose.yml never listed
it, so the bot depended on Coolify passing unlisted variables through. It
is optional: without it the lol commands fail and the rest of the bot
runs.
2026-10-03 12:19:56 +07:00
tiennm99 8c7a0ee313 chore(deploy): keep interpolation syntax out of compose comments 2026-10-03 12:11:38 +07:00
tiennm99 1ee679ad89 fix(deploy): stop exposing renderer tuning as Coolify settings
Coolify lists every ${VAR} that compose.yml references as an app setting,
so the four renderer tuning values showed up as entries to fill in. They
are no longer referenced: the renderer's own defaults apply, and an
override goes into compose.yml as a literal.
2026-10-03 12:11:25 +07:00
tiennm99 83321fa330 refactor(renderer)!: prefix every renderer env var with RENDERER_
The renderer's settings now read RENDERER_HOST, RENDERER_PORT,
RENDERER_MAX_CONCURRENT_RENDERS, RENDERER_RENDER_TIMEOUT_MS,
RENDERER_MAX_OPTIONS, and RENDERER_MAX_OPTION_CHARS, so they read as
renderer settings and cannot clash with the bot's variables, which
Coolify injects into every service. NODE_ENV keeps its standard name.

BREAKING CHANGE: the unprefixed HOST, PORT, MAX_CONCURRENT_RENDERS,
RENDER_TIMEOUT_MS, MAX_OPTIONS, and MAX_OPTION_CHARS are no longer read
by the renderer.
2026-10-03 12:05:56 +07:00
tiennm99 11ed121af9 fix(deploy): add a compose healthcheck for the bot
Coolify ignores its UI health-check settings for Docker Compose apps and
reads each service's healthcheck instead, so the bot reported an unknown
status. It now checks GET / with the image's busybox wget.
2026-10-03 12:01:30 +07:00
tiennm99 277c913f71 refactor(random)!: configure the renderer by base URL as RENDERER_URL
The bot now takes the renderer's base URL and appends each /api/<name>
route itself, instead of taking the full /api/gif endpoint and swapping
its last path segment for /gacha and /genshin. The client, its files, and
its errors are named after the renderer rather than wheelofnames; the
/wheelofnames command keeps its name.

BREAKING CHANGE: WHEELOFNAMES_API_URL is replaced by RENDERER_URL, which
holds the base URL (e.g. http://renderer:3000) rather than the /api/gif
endpoint. compose.yml sets it, so Coolify needs no value.
2026-10-03 11:52:50 +07:00
tiennm99 2ec4a2b371 refactor(renderer)!: drop the API token from the internal renderer
The renderer now runs only on the compose network with no published port
or domain, so a shared bearer token adds nothing. The renderer no longer
checks Authorization or requires API_TOKEN in production, and the bot no
longer sends a token.

BREAKING CHANGE: WHEELOFNAMES_API_TOKEN and the renderer's API_TOKEN are
removed. Never publish the renderer's port: its API is unauthenticated.
2026-10-03 11:45:26 +07:00
tiennm99 3130f5ec36 docs: describe the bundled renderer service 2026-10-03 11:16:54 +07:00
tiennm99 2bb5108151 feat(renderer): deploy the renderer next to the bot in compose
The bot now reaches the renderer at http://renderer:3000/api/gif on the
compose network instead of a separately deployed service. Both share
WHEELOFNAMES_API_TOKEN. CI runs the renderer's lint, typecheck, tests,
render smoke, and image build.
2026-10-03 11:16:54 +07:00
tiennm99 de46809c96 docs: describe the in-tree monkeyd crawler and record the port plan 2026-10-03 11:23:45 +07:00
tiennm99 d211124aae refactor(monkeyd): port the crawler in-tree and drop the submodule
The monkeyd-crawler repository moved into tiennm99/mttools, so recursive
clones of the old submodule URL fail and block every deploy. The crawler,
PDF renderer, and export flow now live under internal/modules/monkeyd,
trimmed to the bot's use: a fixed phone page, the bundled font only, and
the font size as the single export option.
2026-10-03 11:23:45 +07:00
tiennm99 c1393f0ec8 style(gacha): slow the mirror glint sweep to 1800ms 2026-10-02 17:28:18 +07:00
tiennm99 994749cee4 style(gacha): drop the glint flare and slow the streaks to a closer pair
Remove the four-ray star from the mirror glint, bring the two streaks
closer and make them wider, and run the sweep for 1200ms on ease-in-out.
2026-10-02 16:13:42 +07:00
tiennm99 4f80538d51 style(gacha): widen and soften the mirror glint, add a trailing streak
The glint band now fades out over a wider span at a lower peak, a thin
streak trails it, and the sweep runs 800ms on easeInOutSine.
2026-10-02 15:52:09 +07:00
tiennm99 c08839d59e style(gacha): cap the mirror glint at 120/255 alpha 2026-10-02 15:29:39 +07:00
tiennm99 c4bc131372 fix(gacha): blend the mirror glint additively and sweep the whole card
The glint band was a card-sized box sliding diagonally, so the top-right
and bottom-left corners never fell inside it. Draw the band on a box three
times the card's size, centred on it, so every corner is lit.

Blend the glint with plus-lighter and tint it with the card's accent so it
brightens the card's own tone instead of painting flat white over it.
2026-10-02 15:17:13 +07:00
tiennm99 21b9e596bc feat(gacha): put the moon emblem on the pack and card back
The pack prints a crescent moon in its diamond in place of the default star, and the card back carries the same moon in its diamond seal over the miti99bot caption.
2026-10-02 14:57:06 +07:00
tiennm99 dc65ce7df2 feat(gacha): show the card text on its last turn face up
The text switches on as the spinning card turns edge-on for the last time, so it rides in on the final turn instead of fading in after the spin stops.
2026-10-02 14:29:18 +07:00
tiennm99 b48f7602f9 feat(gacha): clear printed text and add a mirror glint on reveal
The pack and the card corners no longer carry text. The card's text stays hidden while it spins and fades in once it lies flat, then a mirror glint sweeps from the top-left corner to the bottom-right as the card comes to rest.
2026-10-02 14:17:09 +07:00
tiennm99 fb0f6dc68e docs(plans): record the thuyvan flood alert research, plan and journal 2026-10-02 13:06:08 +07:00
tiennm99 053fd07e5a feat(weather)!: add /thuyvan flood alerts for Tân Thuận
/thuyvan shows the 5-day tide-peak forecast at Phú An and Nhà Bè from
the Đài KTTV Nam Bộ bulletin PDF, the Open-Meteo rain forecast, and live
VNDMS river gauges within 30 km. /thuyvan_subscribe opts a chat into a
10:30 ICT push, retried at 12:30, sent only when a forecast peak reaches
báo động I (1.40 m) or a day's rain reaches 50 mm. A missing or stale
bulletin fails the push instead of reading as no risk.

The thoitiet module is renamed to weather; the /thoitiet* commands keep
their names.

BREAKING CHANGE: the module key is now "weather". A MODULES list that
names thoitiet fails at startup and must name weather instead.
2026-10-02 13:06:07 +07:00
tiennm99 59c74de9a9 refactor(lol): move the subscriber list and daily push fan-out into a shared package
The subscriber store, the once-per-day claim, the terminal-error
classifier and the throttled fan-out with dead-chat pruning now live in
internal/modules/util/subscription so another module can offer an
opt-in daily push. Stored document shapes and keys are unchanged.
2026-10-02 13:06:07 +07:00
tiennm99 53f387c576 feat(random): add an unlisted /genshin meteor wish command
/genshin takes the same input as /gacha and sends the Genshin-style
meteor wish that wheelofnames serves on /api/genshin, as a 7-second
640x360 MP4. It stays out of the command menu and /help.
2026-10-01 23:38:21 +07:00
tiennm99 59f597016b feat(genshin): serve the Remotion meteor wish on /api/genshin
Brings back the Genshin-style meteor wish that /api/gacha rendered before pack-cards, under genshin names. It takes the same request as /api/gacha and returns the 7-second landscape MP4.
2026-10-01 23:37:27 +07:00
tiennm99 b7a4336a7b chore(gacha): drop the last references to the retired beta route
Removes the test that checked /api/gachabeta answers 404 and the journal for the old beta animation, and points the research reports at /api/gacha.
2026-10-01 23:27:56 +07:00
tiennm99 48a30863c3 fix(gacha): stop the card text moving after the card settles
Three things moved the text once the card looked still:

- The spin's last degrees: Chrome draws text on a slightly tilted card
  differently from a flat one, so glyphs hopped as the spin ran out. The
  spin now lands flat a moment before the card stops gliding.
- The landing: the card flew at its rounded size scaled to a fractional
  layout size, then was laid out again, shifting the text. The card's
  size is now whole pixels.
- The last flight frames: a sub-pixel creep at almost-identity scale drew
  the text differently from the card at rest. The flight now reaches its
  final pose slightly early.
2026-10-01 23:22:51 +07:00
tiennm99 949e5e57ec revert(gacha): restore the original pack tear and drop motion
Only the card rising out of the pack keeps its exponential easing; the scripted tear and the pack falling away move as pack-cards drew them.
2026-10-01 23:22:51 +07:00
tiennm99 76c96464a8 feat(gacha): ease the tear, pack drop, and card rise exponentially
The scripted drag across the seal, the torn pack falling away, and the
card rising out of it now ease exponentially in and out. The pack keeps
pack-cards' 1.35s drop and hold, and the card still clears the pack when
the spin starts.
2026-10-01 22:52:52 +07:00
tiennm99 9e3cf9d78a fix(gacha): park the pointer off the card after tearing the pack
The scripted drag released the mouse over where the card lands. Once the
card arrived under it, pack-cards tilted the hovered card toward the
pointer over its .22s transition, so the face kept moving after the spin
stopped. The pointer now moves to the corner when the drag ends.
2026-10-01 22:43:05 +07:00
tiennm99 9d5a207f54 fix(gacha): keep the polychrome engraving on the card while it flies 2026-10-01 22:34:05 +07:00
tiennm99 6a4d0a1abb feat(gacha): draw the polychrome on the card engravings only
The sliding rainbow sheen over the whole face and the spectrum foil are
gone. 4★ cards are now engraved with pack-cards' epic contour and 5★ cards
with the legendary rings or facets, and those engraved lines carry a still
rainbow; 3★ cards stay plain.

The warm-up also renders a 4★ wish, since the first card with the contour
engraving otherwise rendered about seven seconds slower.
2026-10-01 22:26:37 +07:00
tiennm99 9665a3b47b docs: describe the shipped miti99bot wheel integration 2026-10-01 22:15:17 +07:00
tiennm99 fafe61b28b feat(random)!: send /gacha as the portrait card-pack wish
wheelofnames now renders /api/gacha as the 6-second portrait card-pack
wish and no longer serves /api/gachabeta. /gacha sends it at 360x640, and
the unlisted /gachabeta command and the per-style renderer settings are
removed.

BREAKING CHANGE: /gachabeta is gone; /gacha needs a wheelofnames build that
renders the portrait wish.
2026-10-01 22:13:59 +07:00
tiennm99 7ca1468a43 feat(gacha)!: render /api/gacha as the pack-cards wish
/api/gacha now renders the 6-second portrait pack-cards opening that was
served on /api/gachabeta. The Remotion meteor wish, its timeline, and the
beta route are removed, and the pack-cards renderer and page take the plain
gacha names.

BREAKING CHANGE: /api/gachabeta is gone, and /api/gacha returns a 6-second
portrait video (360x640 for width 640, 480x854 for width 854) instead of the
7-second landscape one.
2026-10-01 22:12:25 +07:00
tiennm99 d657c49c83 feat(gacha): give the beta card a polychrome rainbow foil 2026-10-01 22:07:12 +07:00
tiennm99 eb4208f1df feat(gacha): spin the beta card after it clears the pack, with sparkles
The card now rises out of the pack at pack-cards' own speed and only starts spinning once it is clear. The rest of the flight is stretched so three and a half turns ease out smoothly before the card lands face up, and glowing sparkles in the rarity colour burst around it while it spins. pack-cards is unchanged; the page reshapes its flight animations.
2026-10-01 19:03:31 +07:00
tiennm99 6f7fff5aab feat(random): send /gachabeta clips as 360x640 portrait animations
Each gacha style now carries the frame size it renders, so Telegram receives the beta wish's portrait size while /gacha stays 640x360.
2026-10-01 18:45:08 +07:00
tiennm99 fc3c7ae0c0 feat(gacha): render the beta wish in portrait
/api/gachabeta now returns a portrait video with the requested width as its long edge: 640 renders 360x640 and 854 renders 480x854. The request body is unchanged, and /api/gacha stays landscape. The pack sits higher so it stays in frame while the card rises.
2026-10-01 18:45:06 +07:00
tiennm99 b73347bb4f feat(gacha): spin the beta card one and a half turns as it is revealed
pack-cards reveals the card with a half turn from rotateY(180deg) to 0deg. The page starts that one animation at 540deg, so the card spins further before landing face up, without changing the library.
2026-10-01 18:45:06 +07:00
tiennm99 f9526c4613 fix(random): match the /gachabeta clip length to the 6-second beta wish 2026-10-01 18:22:32 +07:00
tiennm99 f44b8564eb docs(plans): record research on open-source gacha animation projects 2026-10-01 18:22:30 +07:00
tiennm99 8c06fdf498 feat(gacha): render the beta wish as a pack-cards pack opening
/api/gachabeta now tears open a pack-cards collectible pack whose card
shows the request's label, the same B/A/S rank as /api/gacha, and one
star per rarity level; rarity also picks the card material and the pack
colour. pack-cards animates on the browser clock, so the route drives a
shared headless Chrome in deterministic mode over a debugging pipe,
steps virtual time frame by frame, tears the pack with a scripted drag,
and encodes the captured frames with Remotion's bundled ffmpeg. The
page and package are served from disk with all other requests blocked.

The browser stays alive per process and is warmed at start-up, because
the first render compiles the pack's WebGL shaders in software. The
Remotion beta composition and its scene code are removed. pack-cards is
installed from a GitHub tarball pinned to a commit, since it has no npm
release and a moving URL would break npm ci.
2026-10-01 18:22:30 +07:00
tiennm99 25eb1414d4 fix(random): describe /gachabeta generically and match its new length
The beta renderer changed style, so /gachabeta now reads "Gacha (beta
version)" in its command description, package doc, README row, and deploy
guide instead of naming one look. The clip length sent to Telegram is 11
seconds to match the renderer's 10.5-second beta animation.
2026-10-01 16:44:16 +07:00
tiennm99 f75c0e560b fix(gacha): show the requested rank and stars on the beta reveal
The beta splash card used a fixed SSS rank and six stars. It now uses the
same rarity info as /api/gacha: the rank letter (B, A, or S) on the emblem
and name plate, and one star per rarity level beside the caller's label.
2026-10-01 16:36:22 +07:00
tiennm99 081ab00f2e feat(gacha): restyle the beta wish as a six-star wish sequence
The beta wish now cuts like an anime gacha game's six-star wish over 10.5
seconds: a dive through a painterly cloud vortex, a beam pass, a meteor
that stops inside a rainbow halo and bursts, a red flash, falling crystal
comets joined by a red meteor, a black emblem silhouette shedding shards
on a red disc, and a splash card with a name plate and six stars.

Cloud layers are painted once per roll onto a canvas with a seeded noise
displacement, so frames only move the baked image instead of running a
live SVG filter. The /api/gachabeta contract is unchanged.
2026-10-01 16:32:30 +07:00
tiennm99 b8d5544fd6 feat(gacha): rebuild the beta wish as a meteor shower reveal
The beta wish now renders an 8-second night sky over a snow-rimmed
mountain ridge, where coloured meteors glide down the diagonal. A hero
meteor in the rarity colour slows and burns out at the centre, where the
label appears under rank SSS. The toon cloud, comet, and perspective
camera are removed. The /api/gachabeta contract is unchanged.
2026-10-01 16:07:46 +07:00
tiennm99 adea684a2f feat(gacha): refine beta wish animation and SSS reveal 2026-10-01 15:42:54 +07:00
tiennm99 11f458fee5 feat(random): group the random pickers into a random module and add /gachabeta
/random, /wheelofnames, and /gacha move from misc into a new random module
with unchanged command names, so usage stats carry over. The new unlisted
/gachabeta takes the same input as /gacha and renders the toon-shaded beta
wish from /api/gachabeta on the same service, with the same text fallback.
2026-10-01 15:17:11 +07:00
tiennm99 577c0e3a70 feat(modules): add an unlisted command visibility
Unlisted commands can be run by anyone like public ones but never appear
in /help or the Telegram command menu.
2026-10-01 15:17:11 +07:00
tiennm99 d2f09ecb33 feat(gacha): add /api/gachabeta toon-shaded wish style
The beta wish renders an 8-second astrology-themed night sky in toon
shading through a perspective action camera: it dollies toward a hero
cloud, a comet lights the cloud's rim from behind and bursts through it,
the camera chases the comet as its flare builds to a starburst, and the
label appears with an S, SS, or SSS rank. It shares the /api/gacha request
contract and render slots.
2026-10-01 15:07:56 +07:00
tiennm99 dccd524f9d feat(gacha): fly into the rank emblem with a rainbow sunburst and twinkling sky
The meteor now flies in from the upper left and lands on the rank emblem,
so the impact burst becomes the badge reveal. The 5-star rainbow ring is
replaced by a rainbow sunburst of counter-rotating rays. Sky stars twinkle
with short bright flares and cross glints, and each roll draws a fresh
layout from a per-request seed that the route picks when the caller sends
none.
2026-10-01 14:43:46 +07:00
tiennm99 9b93c53647 revert: restore the gacha animation to bd314b4
Reverts be27792 (measured straight glide) and 028ad08 (gravity arc), going
back to the B/A/S tier-escalation version with the original curved fall.
2026-10-01 14:26:33 +07:00
tiennm99 e158319981 docs(plans): record the measured meteor curve from reference footage 2026-10-01 14:12:03 +07:00
tiennm99 dc8f7f6ae7 feat(gacha): match the meteor glide to the source game's motion
Measured from reference footage, the meteor sweeps in along a straight line
from the upper left at about 23 degrees and eases out exponentially to a
hover above the horizon, replacing the gravity arc. The trail is now a soft
beam that narrows into the head with ribbons fanning along it, every tier
gets the horizontal lens flare, and sparkles drift above the beam.
2026-10-01 14:12:01 +07:00
tiennm99 4fa0e10384 docs(plans): record gacha research and the rarity prefix format 2026-10-01 13:59:12 +07:00
tiennm99 5561c33068 feat(misc): default /gacha options to 5 stars with a 3*/4* prefix
Rarity is now a leading prefix such as "4* Pho" or "3* Rice"; options
without one are 5 stars. This replaces the trailing "*5" tag and its
3-star default.
2026-10-01 13:59:12 +07:00
tiennm99 004325d947 feat(gacha): make the meteor fall under real gravity
The meteor now follows a ballistic parabola: constant horizontal speed and
vertical speed growing under gravity solved from the launch and impact
points, so it climbs slightly, bends over, and dives while speeding up. The
trail samples past positions in time so it lengthens with speed, the head
stretches along its velocity, and sparks inherit the meteor's velocity and
fall under their own gravity.
2026-10-01 13:58:38 +07:00
tiennm99 adc2b94ae9 feat(gacha): escalate the wish animation by rarity with B/A/S rank emblems
Every beat now scales from a per-tier effects table: 4-star adds a bigger
meteor, lens flare, impact shake, and double shockwave; 5-star adds a
rainbow halo before landing, a gold sky flood, a starburst, counter-rotating
rays, falling sparkles, and an emblem sheen. The emblem shows the rank
letter instead of the label's first character.
2026-10-01 13:25:06 +07:00
tiennm99 b3c46a2f2f docs(plans): note the switch to uniform gacha odds 2026-10-01 13:09:08 +07:00
tiennm99 4816f71fe3 feat(misc): give every /gacha option an equal chance
The rarity tag now only styles the wish animation and the result text, so
/gacha picks like /random.
2026-10-01 13:09:08 +07:00
tiennm99 070f303b35 docs(plans): record the gacha wish command plan 2026-10-01 13:02:46 +07:00
tiennm99 858eaa066b feat(misc): add /gacha Genshin-style wish picker
Options take an optional *4 or *5 rarity tag; untagged options are 3 stars.
A pick rolls a tier at Genshin base rates over the tiers present, then an
option uniformly within it, so untagged input matches /random. The wish
animation renders as MP4 on the wheelofnames service at /api/gacha, with a
text fallback when the renderer is unset or fails.
2026-10-01 13:02:46 +07:00
tiennm99 53ca1e59b3 refactor(misc): share the renderer POST and placeholder helpers 2026-10-01 13:02:46 +07:00
tiennm99 97d8aeaadf feat(gacha): add /api/gacha wish animation rendered as MP4
A meteor coloured by rarity falls across a night sky, lands in a white
flash, and the label is revealed with its stars popping in. The caller
picks the result and rarity; the route only draws it. Renders as silent
H.264 so Telegram plays it as an animation without GIF banding, and
shares the render slots with /api/gif.
2026-10-01 11:43:42 +07:00
tiennm99 61d0e74709 refactor(render): share the render core and bearer check across routes 2026-10-01 11:43:42 +07:00
tiennm99 2fd362dd01 feat(thoitiet): make /thoitiet an hourly forecast for the next 6 hours 2026-10-01 10:34:03 +07:00
tiennm99 f748d34095 feat(thoitiet): add today, tomorrow, and 7-day weather commands 2026-10-01 10:28:10 +07:00
tiennm99 4607ae5f14 feat(help): split /help into several messages past Telegram's length limit 2026-10-01 10:28:09 +07:00
tiennm99 7cc0ead54f refactor: remove the unused gold spot-price chain and lol ErrEmptyResult 2026-09-30 14:20:38 +07:00
tiennm99 897e37ba80 fix(storage): return Mongo List keys in key order like the memory store 2026-09-30 14:20:27 +07:00
tiennm99 00eccd5f5b fix(stats): clear a moved username from its previous holder's rows 2026-09-30 14:20:08 +07:00
tiennm99 fdd8f6af44 fix(server): wait for polling and the final metrics flush on shutdown 2026-09-30 14:19:49 +07:00
tiennm99 1d42887d6b fix(server): return 500 when a handler panics before writing 2026-09-30 14:19:39 +07:00
tiennm99 83a5b8135f fix(gold): switch to a managed VNAppMob key when the env key is rejected 2026-09-30 14:19:30 +07:00
tiennm99 72b2b21912 fix(wordle): stop giveup from recording a second loss on exhausted rounds 2026-09-30 14:19:20 +07:00
tiennm99 cf620a257e docs: fix stale code comments and add missing package docs
Correct comments that described the retired webhook transport, a removed
/cron route, the old KV store and wrapper types, and behaviour that has since
changed; drop plan and review labels; reword two startup log lines that
overstated or misnamed what they report.
2026-09-30 14:19:01 +07:00
tiennm99 d51bcbd224 docs: correct README, deploy guide and module docs against current code 2026-09-30 14:17:31 +07:00
tiennm99 97aaba83ec feat(misc): add /giaxang Petrolimex retail fuel prices 2026-09-30 11:44:42 +07:00
tiennm99 749cd516a3 feat(lol): drop EMEA Masters and CBLOL from the schedule allowlist 2026-09-21 08:47:32 +07:00
tiennm99 26c9431331 build: stop publishing the host port under Coolify
Coolify attaches the container to its proxy network and routes to the exposed
port, so the host publish was redundant and additionally reachable on
0.0.0.0:3000 outside TLS. Left commented for standalone `docker compose up`.
2026-09-19 16:32:45 +07:00
tiennm99 53e569ca12 feat(blacklist): add /blacklist shorthand and /whitelist_rnd
/blacklist is the short form of the two read commands: bare it lists both
lists like /blacklist_rules, and given text it judges that text like
/blacklist_check. Both long names stay for when the intent should be
explicit. An argument of only whitespace is not an argument, so it lists.

/whitelist_rnd returns one whitelist entry chosen at random, and says the
list is empty rather than answering with nothing. It reads only the
whitelist, and only for the calling topic.

The six existing command descriptions are shortened alongside. /help
renders as one un-chunked message pinned at 4096 runes, and two more
commands pushed it to 4123; the shorter wording brings it to 4049. That
ceiling is a shared limit this module did not create, and it will bind again
on the next command added anywhere in the repo.
2026-09-15 13:58:45 +07:00
tiennm99 c47bcf2c7f feat(blacklist): show the changed list after every add and remove
/blacklist_add, /blacklist_del, /whitelist_add and /whitelist_del now answer
with the current contents of the list they touched, so the sender sees the
result without following up with /blacklist_rules.

All four outcomes end the same way, including the two that change nothing:
text already present, and text that was not there to remove. Those are
exactly when someone wants to see what the list holds, and "every add and
remove shows the list" is a simpler rule than one conditional on whether a
write landed.

The confirmation line shares the listing's byte budget, so a long list
cannot push the combined reply past Telegram's message limit.
2026-09-15 13:48:34 +07:00
tiennm99 e5125fcd93 feat(blacklist): add per-topic text deny-list with whitelist exceptions
Six public commands let any member of a chat curate two lists of text and
ask whether a given text is blocked: /blacklist_add, /blacklist_del,
/whitelist_add, /whitelist_del, /blacklist_rules and /blacklist_check.

The module is passive. It never reads ordinary chat messages and never
deletes, warns or restricts anyone; the lists stay inert until
/blacklist_check asks about a specific text.

Scope is one forum topic, keyed (Chat.ID, MessageThreadID) and gated on
IsTopicMessage so a reply chain in a plain supergroup does not become its
own unreachable scope. A plain group, a DM and a forum's General topic all
resolve to one chat-wide list.

Matching is substring, after NFKC composition, case folding and whitespace
collapse. Diacritics stay significant, so ma, má and mà are three entries.
A whitelist entry rescues a blacklist match only when it spans that match,
which is what keeps "I met an assassin, dumbass" blocked.

Entry text is percent-encoded before it becomes a storage key, since keys
forbid '/' and cap at 1500 bytes, and is capped at 200 bytes before and
after normalization because NFKC can expand as well as contract.

/blacklist_rules reads each list with Scan, so listing costs one round trip
per list rather than a Get per entry.
2026-09-15 13:37:03 +07:00
tiennm99 d2272bd84d fix(alias): tell an unreadable reply apart from an unsupported one
Replying to another bot's message and running /alias answered with the
list of kinds that can be saved, which blames the format of a message
the bot was never shown — it may well have been a photo. Telegram strips
the content of another bot's message, and the sender is not always marked
as a bot: an anonymous or service-posted message arrives equally empty,
so the existing bot check missed it.

Judge on whether any content arrived instead. A reply with no content
field at all, and a command that arrives with no reply attached, now both
say what happened and end with the one action that works: forward the
message into the chat and reply to your own copy. A reply that did arrive
with content of a refused kind — a poll, a location — still gets the list
of supported kinds.

One contentFields table backs both the check and the alias_capture debug
line, so the log line always explains the refusal the caller was given.
2026-09-08 16:20:35 +07:00
tiennm99 67836f0cf5 test(amlich): pin the golden fixture to LF
The table is compared byte-for-byte against output generated with \n, so
a Windows checkout with core.autocrlf=true rewrote the committed fixture
to CRLF and failed the comparison on that machine only — passing in CI,
and printing a diff whose two sides looked identical.

The pattern matches text extensions under testdata only: forcing text
conversion on a binary fixture would corrupt it.
2026-09-08 16:20:35 +07:00
tiennm99 8260d2860b fix(alias): answer inline queries from one store read under a deadline
Telegram expires an inline query and then rejects the answer with "query
is too old and response timeout expired or query ID is invalid". The
picker invited that: it listed the names and then read the store once per
name — up to 50 round trips per keystroke — and it was the only handler
in the module with no deadline of its own. Updates are dispatched one at
a time, so a single slow answer also held up the queries queued behind
it, each ageing while it waited, and one slow read expired a whole burst
of typing.

Add DocStore.Scan, which reads a key prefix with its values in one round
trip, ordered by key. The picker and /aliases both use it, so neither
grows a round trip per saved alias. Bound the inline handler at 3s: an
answer later than that is rejected anyway, and giving up frees the worker
for the fresher query behind it. When Telegram does reject an answer, the
error now carries how long it took, which separates a slow handler from a
query that was already stale on arrival.

The 50-result cap now counts results the picker can show, so a video-note
alias — which has no cached inline type — no longer consumes a slot.
2026-09-08 16:02:39 +07:00