feat(ay): fix ayyy(lmaooo) and remove lto so that compiling doesnt take ages
This commit is contained in:
parent
ead0e99aa0
commit
aebdcbb0e5
2 changed files with 20 additions and 7 deletions
|
|
@ -9,7 +9,6 @@ overflow-checks = false
|
||||||
debug = "none"
|
debug = "none"
|
||||||
debug-assertions = false
|
debug-assertions = false
|
||||||
strip = true
|
strip = true
|
||||||
lto = "fat"
|
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ static CHEESEBURGER_REGEX: Lazy<Regex> =
|
||||||
Lazy::new(|| Regex::new("[Cc]heeseburger(s)?").expect("invalid regex"));
|
Lazy::new(|| Regex::new("[Cc]heeseburger(s)?").expect("invalid regex"));
|
||||||
|
|
||||||
static AY_REGEX: Lazy<Regex> =
|
static AY_REGEX: Lazy<Regex> =
|
||||||
Lazy::new(|| Regex::new("[Aa][Yy]*").expect("invalid regex"));
|
Lazy::new(|| Regex::new("(^|\\s)[Aa][Yy]+($|\\s)").expect("invalid regex"));
|
||||||
|
|
||||||
pub struct ErrorCodeHandler;
|
pub struct ErrorCodeHandler;
|
||||||
|
|
||||||
|
|
@ -166,7 +166,14 @@ impl EventHandler for ErrorCodeHandler {
|
||||||
for ay in AY_REGEX.find_iter(&msg.content){
|
for ay in AY_REGEX.find_iter(&msg.content){
|
||||||
output += &msg.content[lastpos..ay.start()];
|
output += &msg.content[lastpos..ay.start()];
|
||||||
|
|
||||||
let str = ay.as_str();
|
lastpos = ay.end();
|
||||||
|
|
||||||
|
let mut str = ay.as_str();
|
||||||
|
|
||||||
|
if str.starts_with(' '){
|
||||||
|
str = &str[1..];
|
||||||
|
output.push(' ');
|
||||||
|
}
|
||||||
|
|
||||||
let mut chars = str.chars();
|
let mut chars = str.chars();
|
||||||
|
|
||||||
|
|
@ -181,16 +188,23 @@ impl EventHandler for ErrorCodeHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
for char in chars{
|
for char in chars{
|
||||||
if char.is_lowercase(){
|
if char == ' '{
|
||||||
output.push('o')
|
output.push(' ');
|
||||||
} else {
|
break;
|
||||||
output.push('O')
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
lastpos = ay.end();
|
if char.is_lowercase(){
|
||||||
|
output.push('o');
|
||||||
|
} else {
|
||||||
|
output.push('O');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output += &msg.content[lastpos..];
|
||||||
|
|
||||||
msg.reply(&ctx.http, output).await.ok();
|
msg.reply(&ctx.http, output).await.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue