From 8e7d1a79da5de2d3c9eeb94b25693e368cd85060 Mon Sep 17 00:00:00 2001 From: Lyra Wolves Date: Wed, 15 Aug 2018 06:19:04 -0500 Subject: [PATCH 1/5] Update URL in syntax.md --- src/syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syntax.md b/src/syntax.md index 6e9b611..3269eb8 100644 --- a/src/syntax.md +++ b/src/syntax.md @@ -1,2 +1,2 @@ **What is Regex?** -Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/regex/index.html). +Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/). From 62112ba002cd486381253a6ad9421f63f270608c Mon Sep 17 00:00:00 2001 From: Lyra Wolves Date: Wed, 15 Aug 2018 06:29:44 -0500 Subject: [PATCH 2/5] Update URL in help.md --- src/help.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/help.md b/src/help.md index f321979..59ae6dd 100644 --- a/src/help.md +++ b/src/help.md @@ -2,4 +2,4 @@ I am the new grepbot. You can tell me what you're interested in, and I'll let you know if people start talking about it. All I am is a regex evaluation bot, though. Don't expect anything super clever. **What is Regex?** -Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/regex/index.html). +Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/). From 2019f25faf8b6e1940fa9c9f085f10a875955340 Mon Sep 17 00:00:00 2001 From: Lyra Wolves Date: Wed, 15 Aug 2018 07:28:21 -0500 Subject: [PATCH 3/5] Add purge greps v0 --- src/handler.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/handler.rs b/src/handler.rs index ad020b4..8e6c7a4 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -71,6 +71,8 @@ impl Handler { "https://github.com/TumblrCommunity/grepbot".into() } else if content == "author" { "talk to artemis (https://github.com/ashfordneil)".into() + } else if content == "purge"{ + Self::purge_greps(content,greps,author) } else { include_str!("usage.md").into() } @@ -123,7 +125,18 @@ impl Handler { }) .unwrap() } - + /// Removes all greps from a user. + fn purge_greps(content: &str, greps: &mut HashSet, author: +&User)->String{ + ///probably very inefficient + ///should be able to just remove all greps at once + ///this is mostly to test the idea + for x in greps.iter(){ + let y="remove "; + y.push_str(x); + remove_grep(y,greps,author); + } + } /// Removes a grep from a user. Accepts a message that beings with "remove ", and then removes the /// grep associated with the user whos regular expression is equal to the remainder of the message. fn remove_grep(content: &str, greps: &mut HashSet, author: &User) -> String { From dd67ad2915d8a238407d7ae44e293685695f0d0f Mon Sep 17 00:00:00 2001 From: Lyra Wolves Date: Sat, 18 Aug 2018 22:54:54 -0500 Subject: [PATCH 4/5] Updated Link --- src/help.md | 2 +- src/syntax.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/help.md b/src/help.md index 59ae6dd..8ac2d86 100644 --- a/src/help.md +++ b/src/help.md @@ -2,4 +2,4 @@ I am the new grepbot. You can tell me what you're interested in, and I'll let you know if people start talking about it. All I am is a regex evaluation bot, though. Don't expect anything super clever. **What is Regex?** -Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/). +Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://docs.rs/regex/0.2.10/regex/) diff --git a/src/syntax.md b/src/syntax.md index 3269eb8..ae24b1d 100644 --- a/src/syntax.md +++ b/src/syntax.md @@ -1,2 +1,3 @@ **What is Regex?** -Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://doc.rust-lang.org/regex/). +Regex (or regular expressions, formally) +are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://docs.rs/regex/0.2.10/regex/) From 843c2109b7d179fa4bb524f586cb085a823fefb6 Mon Sep 17 00:00:00 2001 From: Lyra Wolves Date: Sat, 18 Aug 2018 23:34:49 -0500 Subject: [PATCH 5/5] Remove extra newline from prior commit --- src/syntax.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/syntax.md b/src/syntax.md index ae24b1d..222cc43 100644 --- a/src/syntax.md +++ b/src/syntax.md @@ -1,3 +1,2 @@ **What is Regex?** -Regex (or regular expressions, formally) -are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://docs.rs/regex/0.2.10/regex/) +Regex (or regular expressions, formally) are a way to write out regular grammars. For those who are interested, you could find a little more info on regular grammars and the theory behind regular expressions here (https://www.tutorialspoint.com/automata_theory/regular_expressions.htm). And for those of you who've used regex before, you'd know that every regex engine has its own syntax. This bot uses the rust regex library, which has its syntax documented here (https://docs.rs/regex/0.2.10/regex/)