Discord chat bot WIP using simple Markov chains
How to use
- Insert your bot key
// Init var discord, err = discordgo.New("Bot " + "your bot key here")
$ go mod vendor
$ go run ben.go
Make sure you have Administrator permissions in your Discord guild and run the following:
ben set channel 1234567890 where 1234567890 is the ID of the channel you want Ben to talk to and record from.
More settings and profiles possibly to come…
All you have to do to train Ben is talk to him for a while. He will start responding as he understands more word associations. It works by linking pairs of words to a new word in the sentence based on what it has seen before.
I will go to the store
I will go to the mall – “I will” is associated with “go” as the next word in the chain twice of two times which means “go” will be picked 100% of the time as the next word after “I will” on sentence generation. In contrast, “to the” will either be associated with “store” or “mall” on a 1/2 probability since they are each seen once of the two possible next word outcomes.
I will arrive to the destination shortly may print out something like this:
I will arrive to the mall as it searches backwards (as of writing) and sees the first non-determinate pair “to the”, which has been trained to know to say “store”, “mall”, and now “destination”. Also note, “I will” is now associated with “arrive”.
The system gets complex rather fast so there is not a ton of talking to yourself to get Ben going.
Here are a couple interesting/funny outputs I have read between this version and the old source code. Of course, you cannot expect high quality output from such a simple model consistently. Expect a lot of gibberish with some brilliance sprinkled in.
Ben has a bright idea and demonstrates the algorithm:
Ben has had enough and leaves for greener pastures:
On the origins of Skynet from Ben Classic:
If you train him right, Ben is very funny and can be insightful. This is just a very small sample of all the times server members have had a laugh.
Problem: Ben doesn’t talk?
He will not talk likely for a while as there is no database that I am shipping with this. It is up to you and your Discord server to fill the database yourself and teach it interesting things to say. The more you talk the more likely he will talk.