diff --git a/.gitignore b/.gitignore index a5cbe4f..dad345c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# Build files /target + +# Tokens .env + +# Hidden files +/src/.* + +# IDE config .vscode \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 03fddad..09b7357 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,11 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +rand = "0.8.5" anyhow = "1.0.71" -cron = "0.12.0" +# cron = "0.12.0" dotenv = "0.15.0" -mongodb = "2.6.0" -poise = "0.5.5" +# mongodb = "2.6.0" +# poise = "0.5.5" serenity = { version = "0.11.6", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "http"] } serenity_utils = "0.7.0" tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] } diff --git a/src/main.rs b/src/main.rs index 71198aa..9bc6801 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,12 +4,14 @@ use serenity::model::channel::Message; use serenity::model::gateway::Ready; use serenity::prelude::*; use util::security::dotenv_var; +use other::msg::hello; mod message_handler; use message_handler::handle; mod commands; mod util; +mod other; struct Handler; @@ -44,6 +46,9 @@ impl EventHandler for Handler { Ok(_) => return, }; } + // if ready.user.name != "MOOver Debug" { + hello(ctx.http).await; + // } } } diff --git a/src/other/mod.rs b/src/other/mod.rs new file mode 100644 index 0000000..12c5537 --- /dev/null +++ b/src/other/mod.rs @@ -0,0 +1 @@ +pub mod msg; \ No newline at end of file diff --git a/src/other/msg.rs b/src/other/msg.rs new file mode 100644 index 0000000..fd4ad4c --- /dev/null +++ b/src/other/msg.rs @@ -0,0 +1,23 @@ +use serenity::http::Http; +use std::sync::Arc; + +pub async fn hello(http: Arc) { + let messages = [ + "AAAAAAAAAAAAAAAAAAAA", + "Henlooo", + "Good day y'all!", + "May have crashed...", + "MOOOooo", + "Heyyyyy!", + "I'm baaaaack!", + "Whom'st have summoned the ancient one?", + ]; + + let channel = http.get_channel(780439236867653635).await.unwrap(); + + let num = rand::random::() % messages.len(); + + if let Err(why) = channel.id().say(http, messages[num]).await { + print!("Error sending message: {:?}", why); + }; +} \ No newline at end of file diff --git a/src/sample.rs b/src/sample.rs deleted file mode 100644 index f5c9e80..0000000 --- a/src/sample.rs +++ /dev/null @@ -1,19 +0,0 @@ -struct MyStruct { - niečo: String, -} -impl MyStruct { - fn add(&mut self) { - self.niečo.push(char::from_digit(2, 2).unwrap()); - } -} -trait Countable { - fn count(&self) -> usize; -} -impl Countable for MyStruct { - fn count(&self) -> usize { - self.niečo.len() - } -} -fn smt(var: Box) { - var.count(); -} \ No newline at end of file diff --git a/src/util/security.rs b/src/util/security.rs index 7473fcb..80f2829 100644 --- a/src/util/security.rs +++ b/src/util/security.rs @@ -8,4 +8,4 @@ pub fn dotenv_var(key: &str) -> Option { Ok(val) => return Some(val), Err(_) => None } -} +} \ No newline at end of file