This is supposed to crash

This commit is contained in:
LinlyBoi
2022-08-08 20:55:54 +02:00
parent 3959498053
commit e2bac6ae81

View File

@@ -15,15 +15,18 @@ impl EventHandler for Handler {
// Event handlers are dispatched through a threadpool, and so multiple // Event handlers are dispatched through a threadpool, and so multiple
// events can be dispatched simultaneously. // events can be dispatched simultaneously.
async fn message(&self, ctx: Context, msg: Message) { async fn message(&self, ctx: Context, msg: Message) {
let mut phrase = String::from("not pog"); let text = msg.content.to_string();
if msg.content == "hello" { let phrase = ungabunga(&text);
phrase = "http://nohello.com".to_string();
} // This code was written by idiot (me)
else if msg.content == "help" // if msg.content == "hello" {
{ // phrase = "http://nohello.com".to_string();
phrase = "https://dontasktoask.com/".to_string(); // }
} // else if msg.content == "help"
else if msg.content == "!help" // {
// phrase = "https://dontasktoask.com/".to_string();
// }
if msg.content == "!help"
{ {
let dm = msg.author.dm(&ctx, |m| m.content("I hate you")).await; let dm = msg.author.dm(&ctx, |m| m.content("I hate you")).await;
if let Err(why) = dm { if let Err(why) = dm {
@@ -77,3 +80,12 @@ async fn main() {
println!("Client error: {:?}", why); println!("Client error: {:?}", why);
} }
} }
fn ungabunga(txt: &str) -> String {
match txt {
"hello" | "hi" | "hey" => return "https://nohello.com".to_string(),
"help" | "can anyone help?" | "helppp" => return "https://dontasktoask.com".to_string(),
_ => return "not pog".to_string(),
}
}