From 6792f8192b341d3a4c9cd7b28017e16206bc43e5 Mon Sep 17 00:00:00 2001 From: Ladislav Hano <524934@mail.muni.cz> Date: Fri, 16 Feb 2024 22:49:57 +0100 Subject: [PATCH] =?UTF-8?q?Lo=C4=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/message_handler.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/message_handler.rs b/src/message_handler.rs index d55a4a6..f0ba326 100644 --- a/src/message_handler.rs +++ b/src/message_handler.rs @@ -1,4 +1,5 @@ use rand::random; +use serenity::http::CacheHttp; use serenity::{client::Context, http::Http}; use serenity::model::channel::Message; use std::sync::Arc; @@ -28,12 +29,19 @@ pub async fn handle(ctx: Context, msg: Message) { } } + if random::() % 1000 == 666 { + match msg.reply(ctx.http(), "Povedz loď").await { + Ok(_) => {}, + Err(e) => send_error(ctx.http.clone(), e.to_string()).await + } + } + let channel_id = match moove_check(&msg).await { Some(val) => val, None => return }; - match moove(ctx.http, msg, channel_id).await { + match moove(ctx.http, msg.clone(), channel_id).await { Ok(_) => return, Err(e) => println!("ERROR: {e}") };