Merge branch 'main' into ver-0.0

This commit is contained in:
ZyLacx 2024-01-22 19:54:16 +01:00 committed by GitHub
commit 8bd4c59d90
7 changed files with 42 additions and 23 deletions

8
.gitignore vendored
View file

@ -1,3 +1,11 @@
# Build files
/target
# Tokens
.env
# Hidden files
/src/.*
# IDE config
.vscode

View file

@ -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"] }

View file

@ -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;
// }
}
}

1
src/other/mod.rs Normal file
View file

@ -0,0 +1 @@
pub mod msg;

23
src/other/msg.rs Normal file
View file

@ -0,0 +1,23 @@
use serenity::http::Http;
use std::sync::Arc;
pub async fn hello(http: Arc<Http>) {
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::<usize>() % messages.len();
if let Err(why) = channel.id().say(http, messages[num]).await {
print!("Error sending message: {:?}", why);
};
}

View file

@ -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<dyn Countable>) {
var.count();
}

View file

@ -8,4 +8,4 @@ pub fn dotenv_var(key: &str) -> Option<String> {
Ok(val) => return Some(val),
Err(_) => None
}
}
}