py4l/blog

Under the hood: our Discord bot

2026-11-09 00:06:52 · py4l

Call it a community bot & most people picture a moderation script: it deletes spam, bans repeat offenders, maybe answers an FAQ. Ours does that too, live across Discord, Matrix & other chat platforms — but moderation is the smallest part of what it actually runs.

Mention it directly & it answers as a real machine-learning assistant, not a canned script — more than one model to query by name, context-aware replies, & tool calling so it can actually act on what it's asked instead of just describing what it would do.

It hosts a full social-deduction werewolf game inside the server, on a deterministic, tested game engine underneath two different rule sets — a classic villager/werewolf/seer/doctor lineup, & a second variant with its own cast of roles & mechanics, including a kidnap-&-rescue & a police arrest with a real demotion risk. Some lobbies run for real stakes: a USDC entry fee, a prize pool split among the winning team at the end.

That economy isn't cosmetic. Players link a real on-chain wallet via Sign-In With Ethereum, hold real custodial balances across three chains & three assets — Monero, Dogecoin, USDC — & climb a weekly points leaderboard that's dollar-denominated & built to resist abuse: an AFK player, a cancelled game, an under-filled lobby all score zero, with the exact reason recorded, not just silently dropped.

The best joke in the whole bot is Truth or Dare. On paper it's a party game. In practice, "Dare" has about a 72% chance of coming up, & the dare is to open-source your code with a proper security pass. Behind that framing sits real tooling: secret scanning, SSRF checks, license & dependency audits, repository analysis, even GitHub OSINT — real security review, dressed up as a dare so people actually run it.

Outside the games, it does real work. Show it an image or a GIF & it runs real vision analysis (a GIF gets frame 9 extracted automatically, with a fallback chain if that exact frame is missing). Mention it on a message with real code & the word "run," & it executes that code in a real sandbox — Python, JavaScript, Bash & more — with live status updates while it works, pulling its list of supported languages straight from the sandbox itself rather than a hardcoded guess.

See it live at /playground — the real bot, not a mockup, running right now.