Expand description
catinator is a general purpose irc bot making crate.
Most of the heavy lifting is done by the irc crate, but catinator adds useful high level utilities to make the bot making easier.
Example:
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
// Initialize the bot, loading the config and establishing the connection
let mut bot = catinator::Bot::new().await.unwrap();
// Setup any modules that require it.
let wolfram_alpha = catinator::hooks::wolfram_alpha::WolframAlpha::new(&bot)
.expect("failed to initialize WolframAlpha command");
// Call the catinator macro to setup the hooks, matchers and commands
catinator::catinator![
// For example add the sasl hook to handle sasl authentication
hook("sasl", "Handle Authentication.", AUTHENTICATE, catinator::hooks::sasl),
// Add a matcher that executes on a specific regex
matcher("shifty_eyes", ">.>", r"^\S{3}$", catinator::hooks::shifty_eyes),
// Add an async command that calls a method on the previously instantiated struct.
async command("wa", "Returns Wolfram Alpha results for a query", wolfram_alpha.wa),
];
}
Modules§
- config
- The bots main configuration is housed in the Config struct.
- hooks
- The bots hooks, commands and matchers. For explanation of different types see crate::catinator
- util
- Utilities for dealing with IRC and bot making
Macros§
- catinator
- Main entrypoint to the bot
Structs§
- Bot
- The struct handling bot actions and configuration