class: title-slide # QuatBot ## Manage your meetings on Matrix Adriaan de Groot September 8th, 2019 --- # A little history ## 25 years of IRC - EFnet in the '90s, #koffie, and koffiepot - Freenode in the '10s, lots of bots ## Proprietary IM - WhatsApp - Telegram - Slack ## Open-Source Modern IM - Matrix --- # Matrix Clients ## Native Desktop Clients - **fractal** (GTK+, Rust, Python) - nheko (Qt5, C++, mtxclient) - quaternion (Qt5, C++, libQuotient)
.right[![Fractal](fractal.png)] --- # Matrix Clients ## Native Desktop Clients - fractal (GTK+, Rust, Python) - **nheko** (Qt5, C++, mtxclient) - quaternion (Qt5, C++, libQuotient)
.right[![Nheko](nheko.png)] --- # Matrix Clients ## Native Desktop Clients - fractal (GTK+, Rust, Python) - nheko (Qt5, C++, mtxclient) - **quaternion** (Qt5, C++, libQuotient)
.right[![Quaternion](quaternion.png)] --- # Every IM system needs bots - For fun - For status messages - For ambient intelligence - For keyword expansion
.right[![Robot](3357861-robot.png)] --- # Matrix Clients ## Client Libraries - libQuotient (Qt5, C++) - mtxclient (Boost, C++) --- # libQuotient > The Quotient project aims to produce a Qt5-based SDK to develop applications for Matrix. > libQuotient is a library that enables client applications. It is the backbone of Quaternion, Spectral and other projects. - Modern C++ style - Qt5 based - Uses Olm for crypto --- # libQuotient .left-column[ - `Connection` - `Job` - `Room` - `Event` - `RoomMessageEvent` ] .right-column[ These are all naturally-occurring things in Matrix chat. ] --- # libQuotient - Start some kind of Job to create an Object - Connect to signals for progress in that Job.
**or**
- Get an Object - Connect to signals for state changes in that Object. ``` connect(m_room, &QMatrixClient::Room::addedMessages, m_messageHandler, &Handler::addedMessages); ``` --- # libQuotient - The sync mechanism delivers one or more messages at once - On startup, may include historical messages - Messages are on a `Timeline` which does its own caching and loading ``` void Handler::addedMessages(int from, int to) { const auto& timeline = m_room->messageEvents(); for (int it=from; it<=to; ++it) { const auto* event = timeline[it].viewAs
(); if (!event) continue; } } ``` --- # Room Messages - Plain Text - Richt Text is possible, but it also depends on the sending application ``` message->plainBody(); message->content()->body; ``` --- class: title-slide # QuatBot ## Manage your meetings on Matrix
.right[![Robot](3357861-robot.png)] --- # Meeting as a finite-state-machine .left-column[ - roll-call - people are taking - we're done! ] .right-column[
.right[![Meeting-FSM](meeting.png)] ] --- # Real Meetings are more Complicated .left-column[ - How to respond to roll-call? - "I'm not here" - "Can I go next?" - "Who's in this meeting?" - Breakout - Note-keeping ] .right-column[
.right[![Meeting-FSM](meeting2.png)] ] --- # QuatBot commands Design decisions: - Uses a **command character** - Commands are single words to select a handler - Handler processes the tail of the message
I picked `~`, which is boring; could have been ᕵ --- .left-column[ # Driving FSM by text command - `~status` - `~rollcall` - `~next` ## Dealing with Complications - `~queue` - `~skip` - `~bump` - `~breakout` - `~log` ] .right-column[
.right[![Meeting-FSM](meeting2.png)] ] --- # User-namimg - Full Matrix IDs are unambiguous `@ade:kde.org` - Display names and parts are not `ade`, `[ade]` - No distinguishing features for tab-completed names
Best-guess matching between words and user-Ids and user-names in-channel. --- # Fun Features - `~cowsay` - `~fortune` - `~cookie` - `~coffee` ## Obvious Extensions - `~phab` - `~bug` - recognizing Phab and Bugzilla tags in-text - reporting commits and new issues --- # QuatBot in Practice - Used for Blue Systems weekly meetings - Very few images / gifs / emoji / stickers - Well-defined group of participants - Many alts - Bot runs in screen on a server somewhere - Uptime measured in weeks - A dozen meetings handled so far --- # QuatBot in Practice ## What works - Keeping order, getting through the list - Keeping notes ## What doesn't - Breakouts are a bit clumsy - User-matching is clumsy - Addressing the bot should be easier - Bot reminders are suprising --- # QuatBot in Practice ``` 09:23:55 @adridg ~status *BOT* (quatbot) It is 07:23:03. Your message was sent at 09:23:55. I can see 42 people in the room. I have processed 1 messages and 0 commands. *BOT* (log) Logging is off. *BOT* (meeting) No meeting in progress. *BOT* (coffee) There are 12 cookies in the jar. 09:23:58 @adridg ~cookie bluesystems-bot *BOT* @bluesystems-bot:example.com gets a cookie from the jar. 09:27:13 @adridg ~coffee *BOT* @adridg:example.com is now a coffee drinker. ``` --- class: title-slide # QuatBot ## Manage your meetings on Matrix https://github.com/quotient-im/libQuotient (LGPL 2.1) https://github.com/adriaandegroot/QuatBot (BSD 2-Clause)