Commit Graph

14 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
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
316b91a9fd Remove a couple of old comments
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-06-04 18:00:00 -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
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
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