Commit Graph

8 Commits

Author SHA1 Message Date
fcb4bd6df1 Update to Python 3.12
* Remove toml dependency since that comes with Python as of 3.11
* Update toml usage to tomllib in config.py
* Update `with open(...)` for toml file reading to be 'rb'
* Update Pipfile.lock for locked dependencies to work with Python 3.12

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-07-18 11:39:34 -07:00
8c4bb5ac60 markov: Finish up chain database implementation
Markov now uses a sqlite3 database instead of flat JSON files. This
should significantly speed up saving time, plus reduce the amount of RAM
that it uses. Saving and loading large JSON files was very slow and
caused issues with other plugins, especially when messages were
received. Additionally, in order to save RAM, a cache was used and
periodically flushed when not used, adding some complications to the
implementation. This has all been removed since things get committed on
the fly with the database implementation. The main trade-off we have to
make is the disk space used by the database. This is OK though, because
disk space is cheap while RAM is not.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 12:29:19 -07:00
a823871039 Add log level config option
* Log levels can now be set via the command line and the configuration
  file.
* ServerConfig.load() function takes a file-like object now, rather than
  a string

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 17:21:20 -07:00
1b4084322b Fix markov import tool to use the new plugin API
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:16:22 -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
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
03f2957c8f Add markov_import script
Used to import markov chains to the given channel. No help available.
Use at your own risk.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 20:32:37 -07:00