Commit Graph

22 Commits

Author SHA1 Message Date
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
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
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
98f8dc12bd Set log level to INFO by default
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 20:25:09 -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
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
7b88d861fe Update Plugins to keep a reference to the Bot object instead of server_config
Plugins now use Bots instead of server_configs, this is useful for
checking the currently joined channels and perhaps using the connection
when there isn't one available in the current method.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 17:03:28 -07:00
de477210b1 Add on_connect callback and joined_channels property
* on_connect is called on all plugins on the first message received from
  the IRC server
* joined_channels property gets all of the channels that this bot has
  currently joined in IRC

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-30 16:31:01 -07:00
585f9e5952 Add "enabled" config option
If a plugin has enabled = false, it will not load.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-26 19:47:30 -07:00
f0cfe53c8e Add on_load for plugins
This asynchronous function is called on all plugins right before the IRC
connection is made.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-26 19:06:48 -07:00
9d8ff8e61d Remove bot import from __init__.py
Don't remember when this was added. We don't want it.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 20:31:23 -07:00
82e50f86d6 Add graceful exits
This sets up a set of ropes and pulleys that signal the `Bot.keepalive`
function to clean things up after a quit signal has been sent. This
allows plugins to define an `on_unload` function to save any important
datas on intentional exit.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-24 19:16:15 -07:00
ffb2d4204e Move message size limit logic to base plugin
This is beneficial for all plugins so the bot doesn't accidentally
spam things because the plugin writer didn't check their inputs

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-23 21:11:04 -07:00
9d144924e9 Add channels to server config
This wasn't being loaded before, now it is.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-23 20:55:45 -07:00
87ea9e358f Remove pycache that accidentally got added
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-23 20:52:33 -07:00
cf770af2ff Add log messages for join, part, and kick
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-23 19:00:38 -07:00
a901c2351a Initial commit with functional framework(!) and example plugin
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-05-23 18:47:28 -07:00