Lys

live · 0.5.1Twitch only

A bot for keeping your community connected, starting with Twitch.

Lys

What it is

Lys is a community bot that handles commands, notifications, and integrations.

It currently supports Twitch, but I’m building it with the goal of bringing the same features to other chat platforms.

Why I made it

Lys started because I wanted a better way to organize activities with people on Twitch.

We’d get groups together to play certain games, watch movies, or do other things, but sometimes people would miss out because they didn’t know something was happening.

I wanted a system where people could sign up for the activities they were interested in and get pinged whenever something was being organized.

That was the original idea, anyway.

People started asking for more features, which led to more commands, more integrations, and eventually a much bigger bot than I originally had in mind.

Then I wanted those same features available on Discord.

At that point, I figured that if I could build the bot around a shared core and add support for new platforms through adapters, there wasn’t much reason to stop at Twitch and Discord.

Why not make it available wherever communities spend time chatting?

How it works

Lys is built around a central system that handles its features, commands, and integrations.

Each chat platform connects through an adapter. The adapter handles the platform-specific details, like receiving messages and sending responses, while the main bot handles the shared functionality.

That means adding support for another platform doesn’t require building an entirely new bot.

The goal is for communities to have access to the same commands and features regardless of where they’re chatting.

Where it’s at

Lys currently works on Twitch, and I’m reworking parts of its foundation to make supporting additional platforms easier.

Discord and Telegram are planned, with the longer-term goal of expanding to other platforms as well.

As usual, the list of things I want to add keeps getting longer.

Changelog

0.5.1latest2 new · 3 changes

added

  • lys health checks that the running Lys answers and its chat connections are up, exiting 0 when healthy and 1 otherwise. The container’s healthcheck runs it instead of wget.
  • The MIT license.

changed

  • The weekly Sleeper recap (and !ff recap) is easier to read: results as a scoreboard (@a 162.38–111.32 @b), each highlight with an emoji and a short label (🔥 Top score, 😬 Closest, 💥 Blowout, ⭐ Best player, 🪑 Bench), and items separated by |.
  • The recap’s standings list every team, not only the top 3, with each team’s record and points scored (🥇 @a 6-3 (1,284)), medals for the top 3. A list too long for one message continues in another, without splitting a team or game.
  • The README describes Lys’s features, requirements, setup and every setting.
0.5.02 new · 6 changes

added

  • LOG_CHAT=true (a plain setting in the compose file’s environment, off by default) logs every chat message with its channel, user and text.
  • Each command use is logged once, with the command, channel, outcome (ok, error, timeout, refused, cooling or busy), how long it ran and how long after the message the reply went out. The command’s arguments are never logged.

changed

  • Normal chat messages are no longer logged, unless LOG_CHAT=true.
  • Every log line is a JSON record with a level (ERROR, WARN, INFO or DEBUG), a constant message, a component (router, twitch, chat, eventsub, sleeper, seventv, …) and its details as fields. Failures are ERROR or WARN, where most had no level before. LOG_LEVEL and LOG_FORMAT change the level and format.
  • A command that panics is one ERROR record, with the stack in a field, instead of many lines.
  • A message from Twitch that Lys can’t read is logged by its type and length, instead of up to 200 characters of what it said.
  • Twitch’s token errors are worded so that log redaction doesn’t hide part of them.
  • lys migrate up says which migrations it applied, or that the database is up to date.
0.4.01 new

added

  • !randomcat links a random cat from cataas.com, a picture or a gif at random: “Here’s a random cat. https://cataas.com/cat/…”. When cataas.com can’t be reached it says so: “Couldn’t reach cataas.com, try again in a moment.”
0.3.06 new · 1 fix

added

  • !7tv manages the channel’s active 7TV emote set from chat: add <name or link> [name], remove <emote>, rename <emote> <new name>, undo, sets, set <set>, search <name>, editors, emote <name> and status. Only the streamer and the editors they accepted on 7TV can make changes, each with the permission 7TV gives them (emotes, or switching sets); Twitch roles don’t count.
  • A streamer turns it on by adding LysLink as an editor on 7TV with Manage emote sets, plus Manage profile for !7tv set. Lys accepts the invite within 5 minutes, only from channels it’s in.
  • !7tv undo reverses the channel’s last change within 30 minutes, if nothing has changed it since: “Undo add emote haha by @user”.
  • An add looks the emote up by its 7TV link or ID, or by name (the most-used match), and refuses an emote that’s private, deleted, already in the set or named like one there, or a set that’s full. Replies show the emote’s link and the slots used: “Added KEKW (7tv.app/emotes/…) · 272/600 slots”.
  • Each change is logged as one [7TV] line: who, the channel, the set, the emote, and whether it worked.
  • lys 7tv status shows Lys’s 7TV account, when its session expires, the channels it edits and the invites left pending; lys 7tv check [<channel>] tries each 7TV lookup and says which fail. Lys logs a warning a week before the session expires, and reads a new one from Cove (LYS_SEVENTV_TOKEN) without a restart.

fixed

  • A command repeated from Chatterino or 7TV’s extension, which add an invisible character to get past Twitch’s duplicate filter, now runs like the original instead of reading the character as an extra word.
0.2.05 new · 9 changes

added

  • Free-agent moves are announced in the league’s channels, like trades and waiver claims. Each team’s moves since the last check go out as one message: “🏈 @lu picked up Jaylen Warren and Rashid Shaheed, dropped Zach Ertz”, or “🏈 @lu made 7 free agent moves” when the list won’t fit in one message. !ff alerts freeagents off turns them off.
  • A weekly recap at 10 AM Eastern on the Tuesday after each week’s last game: the results, the highlights (top score, closest game, biggest blowout, best player, most points left on a bench) and the top 3 in the standings, as three messages. Recaps run through the fantasy playoffs, without standings there. A recap more than a day late (Lys was down, say) is skipped. !ff alerts recap off turns them off, and !ff recap [week] shows one any time.
  • !ff help lists the subcommands, and so do !help ff, a bare !ff and a word !ff doesn’t know.
  • !ff unlink @user for moderators and the channel’s owner, to remove a team link someone else made.
  • !ff matchup [@user] [week] shows past weeks too.

changed

  • People who linked their team show by their @name in every Sleeper message, and teams nobody linked by team name.
  • Every Sleeper announcement waits in one queue per league and goes out 90 seconds after the last: trades, waiver claims, free-agent moves, lineup reminders and recaps. Waiver claims, which Sleeper processes all at once, are grouped per team like free-agent moves ("🏈 Waivers: @lu claimed Rashid Shaheed ($12), dropped Zach Ertz"). The queue is kept in the database, so a restart or deploy loses and repeats nothing. A queued move more than 12 hours old, or a lineup reminder more than 30 minutes late, isn’t posted.
  • A bare !ff links the channel’s own league instead of a fixed one.
  • !ff trades [@user] shows the league’s last 3 real trades (or one team’s), instead of made-up ones.
  • !ff draft shows the league’s real draft time and status from Sleeper, instead of a fixed date.
  • !ff standings, scores, roster and playoffs show everything at once, without page numbers; a long answer takes two messages.
  • !ff link <Sleeper name> links your team, and !ff unlink removes your link (!ff link user <name> and !ff unlink user still work). Linking a team someone else has already linked says who, and how a moderator can undo it; linking a second team asks you to unlink the first.
  • Usage messages show the channel’s prefix and ff, every Sleeper reply starts with 🏈, and the error messages are plain: “Couldn’t reach Sleeper, try again in a moment.”
  • A sender whose ID is empty is never taken for the channel’s owner.

all releases on GitHub

More to look at

all projects
  • Plop

    livesign-ups closed during rework

    Send files and text from your phone or browser to your Windows PC without messaging yourself.

  • Crossframe

    live · 1.1.0Chrome · Firefox · Edge

    Stop searching for the same Warframe item on three different websites.

  • Maroo

    in the workshop

    See the bigger picture on Warframe prices, not just one item at a time.