aboutsummaryrefslogtreecommitdiff
path: root/src/hooks/intensify.rs
blob: bbed9d97286d5133de610ec11dd00781a4b2ac0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use anyhow::{Context, Result};
use irc::client::prelude::*;
use macros::privmsg;

/// \[Turn things up to eleven\]. Intensifies things written in brackets.
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()
                .context("failed to get response target")?,
            format!(
                "\x02\x0304[\x1d{} INTENSIFIES\x1d]\x03\x0F",
                content.to_uppercase()
            )
            .as_str(),
        )?;
    })
}