Files
robbit/src/modules/grass.rs

18 lines
683 B
Rust
Raw Normal View History

2024-03-26 19:30:44 -07:00
use irc::proto::Message;
use std::collections::VecDeque;
2024-03-27 21:45:58 -07:00
pub const PATTERN: &str = "^\\$grass (?P<nick>[^\\s]+)";
pub const NAME: &str = "grass";
pub const USAGE: &str = "Usage: $grass <nick>\r\nThis tells the user identified by nick to touch grass";
2024-03-26 19:30:44 -07:00
pub fn touch_grass(captures: regex::Captures, message: &Message, _: &VecDeque<Message>) -> String {
2024-03-26 19:30:44 -07:00
let grass_toucher = captures.get(1).unwrap().as_str();
let complete_message = format!("{} thinks you should go outside and touch some grass, {}",
message.source_nickname().unwrap_or("unknown_nick").to_string(),
grass_toucher);
complete_message
2024-03-26 19:30:44 -07:00
}