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
// events can be dispatched simultaneously.
async fn message(&self, ctx: Context, msg: Message) {
let mut phrase = String::from("not pog");
if msg.content == "hello" {
phrase = "http://nohello.com".to_string();
}
else if msg.content == "help"
{
phrase = "https://dontasktoask.com/".to_string();
}
else if msg.content == "!help"
let text = msg.content.to_string();
let phrase = ungabunga(&text);
// This code was written by idiot (me)
// if msg.content == "hello" {
// phrase = "http://nohello.com".to_string();
// }
// 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;
if let Err(why) = dm {
@@ -77,3 +80,12 @@ async fn main() {
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(),
}
}