From df0e01f05ee895c1d68c711a76fe48d729cdea8c Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Sat, 6 Aug 2022 23:46:54 +0200 Subject: [PATCH] I don't know what the hell I was thinking. --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9458172..0fcd627 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,15 +15,21 @@ 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::new(); if msg.content == "hello" { + phrase = "http://nohello.com".to_string(); + } + else if msg.content == "help" + { + phrase = "https://dontasktoask.com/".to_string(); + } // Sending a message can fail, due to a network error, an // authentication error, or lack of permissions to post in the // channel, so log to stdout when some error happens, with a // description of it. - if let Err(why) = msg.channel_id.say(&ctx.http, "https://nohello.com").await { + if let Err(why) = msg.channel_id.say(&ctx.http, &phrase).await { println!("Error sending message: {:?}", why); } - } } // Set a handler to be called on the `ready` event. This is called when a