Commit Graph

14 Commits

Author SHA1 Message Date
b684e07dfc markov: Move prune behavior to Bot, from Chain
Markov chains used to prune the chains themselves from memory, but now
that behavior is specifically delegated up the chain to the Bot
structure instead.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 23:05:06 -07:00
baa2d285ee Set default save_every on markov to 1800 seconds, or 30 minutes
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 23:03:41 -07:00
9bed657f5f Fix a couple small bugs in markov bot
* .items() call required when loading a markov chain into memory
* `who.nick` instead of `who~ for get_chain call

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:02:09 -07:00
c27ea72c85 Add feedback for markov bot reply chance
This will just send a message to the user who just updated their markov
reply chance with the final value it was set to, so there are no
surprises.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 14:36:28 -07:00
6a1ed5c372 Add random reply chance to markov bot
Whenever someone says something, there's a chance that markov will
interject his opinion. Users can also set the chance between 0.0 and the
default value (in the config) if they want to see markov replies less
often.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 14:29:37 -07:00
57dd547233 Convert values passed in config in markov bot
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-29 21:37:34 -07:00
887c8dc278 Add dirty flag to markov chains
If something is changed in a markov chain it gets flagged as dirty,
which is used to determine whether the chain should be saved.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-27 18:58:06 -07:00
cc30df8706 Move markov nodes to be single strings
Separating strings by spaces is more memory-friendly than using tuples.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-27 18:41:17 -07:00
b4857e3b4a Add naiive markov all and allchain
Markov all grows fast and 5 years of data uses about 2gb in memory. We
can do better.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-27 17:56:52 -07:00
a4958d371e Finally settle on a good model for markov
If you don't use/access your chain every N seconds (300 by default), it
will unload your chain from memory and save it to disk.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-26 20:59:06 -07:00
85d48d368c Add Markov.add function
This is basically just a shorthand, but also abstracts away adding a
line to a markov chain

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-25 19:18:37 -07:00
5c594fc03e Add PLUGIN_TYPE to markov.py
Forgot to add this, whoopsie

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 20:40:53 -07:00
116baccc2a Remove unused MutableMapping import from markov.py
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 20:17:46 -07:00
9c188e30b1 Add initial markov bot plugin
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 19:30:42 -07:00