Frastbot

A reimagining of an old friend as a Markov chain Discord bot

When our friend Frast left our Discord server, it was the end of an era. Despite his caustic attitude, he had a sort of disarming presence that left a hole when he departed. The space just wasn’t the same without his nonsense.

My spirit was lifted when I realized not only that I had the power to replace him with a robot, but that a robot would likely make for better company. I familiarized myself with BtoBastian's Javacord library for creating Discord bots, cannibalized a Markov chain structure from an old name generation project, and got to work. Once I had Javacord cooperating, the work was simple: Frastbot learns to speak by scouring a Discord channel for all of Frast's old messages and loading them into a 3-dimension hashtable; to form sentences, it uses a Markov process, taking the 2 previous words as the state determining which word to add next.

Originally, to determine whether or not to reply to a message, Frastbot used a Naive Bayes classifier trained on all the messages to which Frast had hitherto responded directly. The likelihood Frastbot would interject after a new message was proportional to the probability given by the classifier that the message belongs to the "answer-worthy" class.

In a later update, Frastbot was updated with the ability to study new messages, so that he could visit Frast's new server and learn some new material from his mortal namesake. At this time, Naive Bayes was replaced with simple chance, irrespective of a message's content, as the classifier wasn't compatible with him learning new words and his response patterns appeared essentially random anyway.