Added repo module
This commit is contained in:
@@ -6,14 +6,14 @@ use regex::Regex;
|
||||
//is this the best way to do this? probably not
|
||||
mod modules;
|
||||
|
||||
use modules::{bully, lenny, join_rude, grass, noemo, ttb, help};
|
||||
use modules::{bully, lenny, join_rude, grass, noemo, ttb, help, repo};
|
||||
|
||||
type ModuleFunc = fn(regex::Captures, &Message, &VecDeque<Message>)->String;
|
||||
const NUM_MODS:usize = 6;
|
||||
const NUM_MODS:usize = 7;
|
||||
|
||||
|
||||
const MODULES: [(&str, ModuleFunc);NUM_MODS] = [(lenny::PATTERN, lenny::mod_message), (bully::PATTERN, bully::mod_message), (grass::PATTERN, grass::touch_grass), (noemo::PATTERN, noemo::no_emo), (ttb::PATTERN, ttb::time_to_baby), (help::PATTERN, help::help)];
|
||||
const MODULE_USAGE: [(&str, &str); NUM_MODS] = [(lenny::NAME, lenny::USAGE), (bully::NAME, bully::USAGE), (grass::NAME, grass::USAGE), (noemo::NAME, noemo::USAGE), (ttb::NAME, ttb::USAGE), (help::NAME, help::USAGE)];
|
||||
const MODULES: [(&str, ModuleFunc);NUM_MODS] = [(lenny::PATTERN, lenny::mod_message), (bully::PATTERN, bully::mod_message), (grass::PATTERN, grass::touch_grass), (noemo::PATTERN, noemo::no_emo), (ttb::PATTERN, ttb::time_to_baby), (help::PATTERN, help::help), (repo::PATTERN, repo::link)];
|
||||
const MODULE_USAGE: [(&str, &str); NUM_MODS] = [(lenny::NAME, lenny::USAGE), (bully::NAME, bully::USAGE), (grass::NAME, grass::USAGE), (noemo::NAME, noemo::USAGE), (ttb::NAME, ttb::USAGE), (help::NAME, help::USAGE), (repo::NAME, repo::USAGE)];
|
||||
|
||||
pub fn build_modules() -> Result<Vec<(Regex, ModuleFunc)>, regex::Error> {
|
||||
let mut regex_array: Vec<(Regex, ModuleFunc)> = Vec::with_capacity(NUM_MODS);
|
||||
|
||||
@@ -5,3 +5,4 @@ pub mod grass;
|
||||
pub mod ttb;
|
||||
pub mod noemo;
|
||||
pub mod help;
|
||||
pub mod repo;
|
||||
|
||||
12
src/modules/repo.rs
Normal file
12
src/modules/repo.rs
Normal file
@@ -0,0 +1,12 @@
|
||||
use irc::proto::Message;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
|
||||
pub const PATTERN: &str = "^\\$repo\\s*$";
|
||||
pub const NAME: &str = "repo";
|
||||
pub const USAGE: &str = "Usage: $repo\r\nThis gives the link to the robbit repo";
|
||||
pub const REPO_LINK: &str = "https://github.com/ColinMcKechney/robbit.git";
|
||||
|
||||
pub fn link(_: regex::Captures, _: &Message, _: &VecDeque<Message>) -> String {
|
||||
format!("{}\r\nPRs are always welcome!", REPO_LINK)
|
||||
}
|
||||
Reference in New Issue
Block a user