Files
tiennm99bot/renderer/docs/miti99bot-integration.md
T
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

1.2 KiB

miti99bot Integration

Future bot integration should keep winner handling explicit.

  1. Bot parses /wheelofnamesbeta options.
  2. Bot chooses winnerIndex locally.
  3. Bot calls POST /api/gif.
  4. Bot sends response bytes with Telegram sendAnimation.
  5. Bot caption uses local winner as source of truth.
  6. If the service fails, bot falls back to existing local GIF renderer.

Request

Send Authorization: Bearer <API_TOKEN> with the JSON body.

{
  "options": ["alice", "bob", "carol"],
  "winnerIndex": 1,
  "durationMs": 6500,
  "holdMs": 1200,
  "fps": 15,
  "size": 512,
  "theme": "classic"
}

Response

  • Body: image/gif
  • Headers:
    • X-Wheel-Winner-Index
    • X-Wheel-Winner
    • X-Render-Duration-Ms

X-Wheel-Winner is URL-encoded. Decode it before displaying if service-side winner selection is used.

Gacha

/gacha in miti99bot calls POST /api/gacha on the same service and token. The bot derives the endpoint from WHEELOFNAMES_API_URL by replacing its last path segment (/api/gif becomes /api/gacha), picks the result and rarity itself, and sends the MP4 with sendAnimation. On any failure it falls back to a text reply.