Commit Graph

91 Commits

Author SHA1 Message Date
46b9c52f9c Add check to see if prefix is None in on_message
This was causing crashes, I'm not sure why prefix is coming back empty

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-09-01 17:37:28 -07:00
c051ada8b8 Fix typo -_-
I'm an idiot. paremeters -> parameters

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-08-30 10:09:27 -07:00
6a6a00412a Fix message parameters edge case
Sometimes an incoming message won't have any content (for some reason).
I haven't looked too deeply into the origins of it. This just bypasses
that case and returns early.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-08-30 10:00:23 -07:00
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
d3f88dacf7 Add .dockerignore
We should ignore the data directory because that directory can get quite
large and makes for annoying rebuilds since it has to send all of that
data over to the daemon, and we don't care about that

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-07-18 11:07:43 -07:00
0d440ead76 Add error logging
For specific error messages that come in, we should give back an
error-level log instead of logging to debug or trace.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-07-18 11:05:12 -07:00
40a859083a Add TRACE log level
This is useful for when we want important debug messages, but not
necessarily to be flooded with every message that comes through IRC

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-07-18 11:02:02 -07:00
f700c0f34c Add config.toml as a mapped file instead of copying
This should reduce the number of rebuilds that we have to do for a
simple configuration change

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-07-18 10:57:13 -07:00
801439c9f1 Update restart policy to docker-compose
Omnibot will now restart when not explicitly stopped

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-04-30 10:58:32 -07:00
5471481e8e Add TODO.md and WISHLIST.md
* TODO.md - for small, easier tasks that shouldn't require any (or many)
  new components on the codebase
* WISHLIST.md - for larger tasks that require more work, thought, and
  code to be added. Probably deserving of their own branches.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-03-30 21:21:48 -07:00
5165bf3f2c Update .gitignores
* Add .gitignore to individual data directories, so they can manage
  their own ignored files
* Remove redundant ignored patterns from the root .gitignore that is now
  handled by these individual gitignores (see previous note)
* Remove pickle files from .gitignore since those aren't being used by
  any plugin anymore

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-03-30 20:25:09 -07:00
5aa282143e wordbot: Fix latest wordbot patch (whoopsie)
Last patch was creating a set of the list of all matches, instead of a
set of all matches. This fixes that, and also makes the regex a raw
string.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-03-30 20:13:50 -07:00
Max Marrone
232527cd3a wordbot: Recognize words adjacent to punctuation.
If there was an unmatched word 'foo', and someone wrote 'foo. bar.', wordbot would not recognize the match because it was only splitting the string on spaces, not punctuation.

This treats as a word any contiguous sequence of letters, numbers (just in case) and hyphens (just in case).

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-03-30 20:04:07 -07:00
3ac312db6d markov: Update gitignore to allow db.sql to be added
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 14:34:23 -07:00
8e639d50fa markov: Remove allchain
The allchain has been a source of headaches because it takes up a lot of
memory and slows everything down. However, with the new database
model, we can generate markov sentences using all of the rows since they
are a flat collection. This helps reduce disk space and increases the
import speed significantly.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 14:29:02 -07:00
65dcf8d2ad markov: Update example config to reflect most recent changes
* save_every is no longer necessary so it is removed
* sql_path is added if you need to specify the location of the database
  SQL

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 12:36:49 -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
086ba7706e markov: Trying out a sqlite3-based model
This is a lot simpler from a concurrency perspective. Training values
can get committed to the database immediately, rather than in
long-running flat file batches.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 12:00:33 -07:00
737e032783 linkbot: Minor fix with log message
Returned value could be None, so this accounts for that

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 10:16:46 -07:00
cac2cc20fb Fix linkbot title bug
If an HTML title was parsed with whitespace, it would not strip that
surrounding whitespace. This fixes that.

Also, there are some new debug log messages in linkbot. Hooray!

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-23 09:58:12 -07:00
d7dd0277ca Update priority for config path
Previously, the environment variable would take priority over the
command line argument. This is now reversed.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 20:41:23 -07:00
997033a4e2 Add OMNIBOT_CONFIG environment variable config
If you want to supply an OMNIBOT_CONFIG environment variable value, it's
available.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 20:09:31 -07:00
316b91a9fd Remove a couple of old comments
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 18:00:00 -07:00
ed9c3ddaa2 markov: Reply chance is loaded lazily
Just like the actual chain data structure, this value is now loaded
lazily, since it's stored in the filesystem.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 16:16:52 -07:00
171b4bea81 markov: Add random replies
Forgot to implement this, oops

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 15:55:48 -07:00
6a18a2161c Move another module to the top of the example config because it has full explanations of everything going on
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 20:45:52 -07:00
6707b59a73 Move nickserv config documentation up in the file, since it's pretty important
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 20:40:27 -07:00
2df0e62166 Add nickserv config documentation
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 20:38:36 -07:00
74c98696e4 Add config example for markov bot
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 19:55:26 -07:00
2e7825510e markov: Add some more log messages
Nothing major, just more log messages.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 19:07:09 -07:00
1d016c5164 markov: Add up process-scheduled saving
This allows markov to save (hopefully) in parallel using a
ProcessPoolExecutor. Since objects are sent over-the-wire and copied,
pruning in parallel is not an issue.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 18:24:25 -07:00
04c0d05208 markov: More refined usage of Chain.__touch()
This moves the self.__touch() call around in markov's Chain class such
that it will only access truly available data.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 18:21:34 -07:00
da7d1501e2 markov: Add utility method for last access time update
* Chain.__touch() is a new function that updates the last time a markov
  chain was accessed
* Fix a bug that would not reliably update the last access time of the
  chain during Chain.add()

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-03 18:18:18 -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
418a69c263 Remove unused server.py file
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 23:47:44 -07:00
8e60196588 Remove a couple of unused imports from __main__.py
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 23:29:54 -07:00
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
10ffeaf63a Minor fixups in linkbot on the most recent changes for HTML decoding
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 21:50:22 -07:00
57e1d211a3 Update linkbot to use a fancier parser, and add HTML decoding
* Linkbot parser also looks for <meta> tags and uses an actual HTML
  parser.
* Inner title HTML is decoded before being displayed.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-01 21:43:45 -07:00
741bd85ff7 Add nick to wordbot score message
Whoever scored a point gets a notification for such.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 20:43:48 -07:00
98f8dc12bd Set log level to INFO by default
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 20:25:09 -07:00
0d60f6434a Add docker-compose and Dockerfile
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 20:17:21 -07:00
56e99c237b Add nickserv plugin
This allows the bot to register itself and login.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 19:45:49 -07:00
a0070fca38 Small fix for plugins that accept non-channel messages
There's a long explanation in the code of this commit that says this:

> TL;DR OF THE BELOW: if the first parameter looks like a channel in
> addition to message type, then filter by channel. Otherwise, don't
> filter by channel.
>
> Here's the issue: plugins are *usually* multiplexed by channel. But
> that's only for messages that target channels, such as PRIVMSG and JOIN.
> For non-channel messages, such as server status messages (such as 001 on
> connect, or 372 for MOTD, etc) we want to ignore the channel aspect of
> plugin multiplexing. In order to accomplish this, we just check if the
> first parameter looks like a channel - i.e., starts with an octothorpe #.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 19:43:39 -07:00
94c4ef47ed Add nickname to fortune plugin response
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 18:21:12 -07:00
061cf9ee7b Add get_message_types() to plugin API
This allows plugins to specify the types of messages they handle. This
will be used specifically for the nickserv plugin, but could be useful
for other things too.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 18:14:48 -07:00
0bb17050ec Add a couple of debug log messages to wordbot when a new round is started/finished
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:42:18 -07:00
f105ba4eef Add words.txt for wordbot
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:40:17 -07:00
5cf12406f7 Remove user ping from wordbot leaderboard
When a user's name is used in the !wordbot leaderboard command, we make
every effort to not ping them by interleaving zero-width space
characters in the nickname.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:38:32 -07:00