Robot is a bot for Twitch.TV IRC that learns from people and responds to them with things that it has learned.
Robot has a number of feaatures for managing activity level and knowledge. Generally speaking, the bot is designed to treat chat moderation actions as moderating its knowledge as well. This includes:
In addition to the above, Robot provides explicit moderation commands.
forget pattern
tells robot to forget every message in the last fifteen minutes containing the supplied pattern.
E.g., if the bot's username is "Robot", then saying @Robot forget anime is trash
makes the bot remove all messages in the last fifteen minutes that contain "anime is trash".forget everything
causes Robot to remove all messages in the last fifteen minutes, regardless of content.Robot learns from most messages in the Twitch chats she's in while the stream is online. In order to ensure moderators are able to do their job, she stores additional metadata on those messages as well. Here is the complete list of information types that go into Robot's databases:
In the message metadata, the message sender is stored using a cryptographic hash of the sender's user ID, the channel it was sent to, and the fifteen-minute time period in which it was sent. Roughly speaking, if Robot has been learning from Bocchi, message metadata together with Markov chain tuples can answer questions like these:
On the other hand, it is infeasible or at least very expensive for Robot's data to answer questions like these:
If you want Robot not to record your messages for any reason, simply use the give me privacy
command.
You'll still be able to ask Robot for messages and use other commands.
If you'd like the bot to learn from you again after going private, use the learn from me again
command.
Robot uses the mathematical concept of Markov chains, extended in some interesting ways, to learn from chat and apply its knowledge. Here's an example.
Let's say Robot sees this chat message: Bocchi the Rock!
.
The first thing it will do is run some preliminary checks to make sure it's ok to learn from the message,
e.g. no links, sender hasn't opted out, &c.
This particular message is fine.
Robot's next step is to break it up into a list of tokens – basically words or stretches of non-letter characters followed by spaces.
The tokens here are <beginning of message>
, Bocchi
, the
, Rock
, !
, <end of message>
.
The "beginning of message" and "end of message" are invisible tokens that are always there, at least conceptually.
For each token, Robot now learns that all of the ones before it, as a group, can be followed by the one after. The prefix is made lowercase for this to help improve variety later. That is to say:
Bocchi
can comme at the start of the message.the
can come after bocchi
at the start.Rock
can come after the
after bocchi
at the start.!
can come after rock
after the
after bocchi
at the start.Learning the message is finished. But robots don't like learning things they'll never use.
When it's time for Robot to think of something to say, the bot does a random walk on everything it's learned. Starting with the invisible beginning-of-message token, the bot picks out everything it has learned can follow and picks one option at random.
Let's say it picks the word You
.
Robot records that the random walk went to You
, then looks for everything that can follow <beginning of message>
you
(converted to lowercase, as during learning).
It might pick SHOULD
next; record it and look from <beginning of message>
you
should
, and maybe choose HAVE
; then waited
.
To make generated messages more interesting, Robot can also shorten the length of the context it's using to search when there are few options.
Let's say after waited
it starts applying this technique.
Instead of looking for <beginning of message>
you
should
have
waited
, it drops the beginning token and tries again for messages that contained "you should have waited" anywhere, rather than only at the start.
This might still not help much, so it does it again, and we'll say once more, so that now it's looking for <beginning of message>
you
should
have
waited
.
Now it finds so
as the next token.
Along with adding it to the random walk, it restores one of the tokens it dropped from the random walk, in case that will match something else it's learned.
So the next search happens with should
have
waited
so
.
Next it picks long
, followed by !
and <end of message>
.
So, the generated message is You SHOULD HAVE waited so long!
.
Robot understands commands to be messages which start or end with the bot's username, ignoring case, possibly preceded by an @
character and possibly followed by punctuation when at the start.
For example, if the bot's username is "Robot", then it will recognize these as commands:
@Robot bocchi
bocchi @rObOt
robot bocchi
Robot: bocchi
These are not recognized as commands:
bocchi Robot?
bocchi @Robot kita
¡Robot bocchi!
give me privacy
has Robot stop learning from your messages.learn from me again
undoes give me privacy
.what information do you collect on me?
provides a link to the section on privacy on this page.will you marry me?
asks Robot to be your waifu, husbando, or whatever other label for a domestic partner is appropriate. Robot is choosy and capricious.how much do you like me?
asks Robot to compute your affection score.OwO
genyewates an especiawwy uwu message.how are you?
AAAAAAAAA A AAAAAAA AAA AAAA AAAAAAAA AA AA AAAAA.roar
makes the bot go rawr ;3where is your source code?
provides a link to this page.who are you?
gives a short self-description.generate bocchi
or say bocchi
tells Robot to generate a message using bocchi
as the prompt. (Nothing happens if the bot doesn't know anything to say from there.)echo bocchi
causes Robot to say bocchi
, or whatever other message you give.talk about ranked competitive marriage
gives a short description of Robot's marriage system.forget bocchi
causes Robot to forget everything she's learned from messages containing bocchi
in the last fifteen minutes. As a special case, forget everything
tells her to forget all messages in the last fifteen minutes.Robot sometimes applies special effects to copypasta and randomly generated messages. Effects can be configured per channel. The possible effects are:
OwO
twansfowms a message using the OwO command.o
roplocos vowols woth o.AAAAA
AAAAA AAA AAAAAAA A. (This effect tends to trigger Twitch's spam detection, preventing the message from sending. It is typically disabled for random messages.)