diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/hooks/intensify.rs | 17 | ||||
| -rw-r--r-- | src/hooks/mod.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 10 |
3 files changed, 27 insertions, 3 deletions
diff --git a/src/hooks/intensify.rs b/src/hooks/intensify.rs new file mode 100644 index 0000000..87a4edf --- /dev/null +++ b/src/hooks/intensify.rs @@ -0,0 +1,17 @@ +use anyhow::Result; +use irc::client::prelude::*; +use macros::privmsg; + +pub fn intensify(bot: &crate::Bot, msg: Message) -> Result<()> { + privmsg!(msg, { + let mut chars = text.chars(); + chars.next(); + chars.next_back(); + let content = chars.as_str(); + + bot.send_privmsg( + msg.response_target().unwrap(), + format!("\x02\x0304[\x1d{} INTENSIFIES\x1d]\x03\x0F", content.to_uppercase()).as_str(), + )?; + }) +} diff --git a/src/hooks/mod.rs b/src/hooks/mod.rs index ba4a98d..49ec0ab 100644 --- a/src/hooks/mod.rs +++ b/src/hooks/mod.rs @@ -2,10 +2,11 @@ use anyhow::Result; use irc::client::prelude::*; pub mod sed; +pub mod intensify; pub mod shifty_eyes; -pub use sed::*; pub use shifty_eyes::shifty_eyes; +pub use intensify::intensify; pub fn sasl(bot: &crate::Bot, msg: Message) -> Result<()> { match msg.command { diff --git a/src/main.rs b/src/main.rs index 10082c3..3213d50 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ async fn main() { .with_thread_ids(true) .init(); - catinator!( + catinator![ hook( "sasl", "Handle Authentication.", @@ -34,5 +34,11 @@ async fn main() { r"^s/", catinator::hooks::sed::replace ), - ); + matcher( + "intensify", + "makes everything kinda more intense", + r"^\[.*?\]$", + catinator::hooks::intensify + ), + ]; } |
