aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-06-05 15:07:33 +0200
committerMax Audron <audron@cocaine.farm>2021-06-05 15:10:53 +0200
commit26a16d73ec96b0a111fc6b5388d2ab8cc52ae600 (patch)
tree9c857302f2eddb0bbb4409254f86f63a93358c6a
parentadd privmsg macro (diff)
add intensify
-rw-r--r--src/hooks/intensify.rs17
-rw-r--r--src/hooks/mod.rs3
-rw-r--r--src/main.rs10
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
+ ),
+ ];
}