Browse Source

Fix regex match for remove

master
Graham Littlewood 4 years ago
parent
commit
6a28e03da0
2 changed files with 2 additions and 4 deletions
  1. +1
    -3
      src/commands/cmd_macro.rs
  2. +1
    -1
      src/main.rs

+ 1
- 3
src/commands/cmd_macro.rs View File

@@ -6,8 +6,6 @@ use serenity::{
};

extern crate serde_json;
//use serde::{Deserialize, Serialize};
use serde_json::Result;

extern crate regex;
use regex::{Regex, RegexBuilder, Match};
@@ -88,7 +86,7 @@ impl CmdMacro {
let macros: HashMap<u64, HashMap<String, String>> = serde_json::from_reader(reader).unwrap_or(HashMap::<u64, HashMap<String, String>>::new());
return CmdMacro {
format:
RegexBuilder::new(r#"^!macro\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')(?:\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')\s+(.+))?"#)
RegexBuilder::new(r#"^!macro\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+')(?:\s+([A-Za-z0-9]+|"[^\s]+"|'[^\s]+'))?(?:\s+(.+))?"#)
.multi_line(true)
.dot_matches_new_line(true)
.case_insensitive(true)


+ 1
- 1
src/main.rs View File

@@ -57,7 +57,7 @@ fn main() {
println!("Leo42 v{} is starting in {}", crate_version!(), env::current_dir().unwrap().to_str().unwrap());
let token = env::var("DISCORD_TOKEN")
.expect("Expected a Discord API token in DISCORD_TOKEN environment variable");
let mut event_handler = Handler::new();
let event_handler = Handler::new();
// register commands;
let mut commands = std::vec::Vec::<Box<dyn traits::Command>>::new();
commands.push(Box::new(commands::CmdMacro::new()));