I don't know what the hell I was thinking.
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -15,16 +15,22 @@ 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::new();
|
||||||
if msg.content == "hello" {
|
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
|
// Sending a message can fail, due to a network error, an
|
||||||
// authentication error, or lack of permissions to post in the
|
// authentication error, or lack of permissions to post in the
|
||||||
// channel, so log to stdout when some error happens, with a
|
// channel, so log to stdout when some error happens, with a
|
||||||
// description of it.
|
// 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);
|
println!("Error sending message: {:?}", why);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Set a handler to be called on the `ready` event. This is called when a
|
// Set a handler to be called on the `ready` event. This is called when a
|
||||||
// shard is booted, and a READY payload is sent by Discord. This payload
|
// shard is booted, and a READY payload is sent by Discord. This payload
|
||||||
|
|||||||
Reference in New Issue
Block a user