Merge branch 'main' into ver-0.0
This commit is contained in:
commit
8bd4c59d90
7 changed files with 42 additions and 23 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,3 +1,11 @@
|
||||||
|
# Build files
|
||||||
/target
|
/target
|
||||||
|
|
||||||
|
# Tokens
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
# Hidden files
|
||||||
|
/src/.*
|
||||||
|
|
||||||
|
# IDE config
|
||||||
.vscode
|
.vscode
|
|
@ -6,11 +6,12 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
rand = "0.8.5"
|
||||||
anyhow = "1.0.71"
|
anyhow = "1.0.71"
|
||||||
cron = "0.12.0"
|
# cron = "0.12.0"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
mongodb = "2.6.0"
|
# mongodb = "2.6.0"
|
||||||
poise = "0.5.5"
|
# poise = "0.5.5"
|
||||||
serenity = { version = "0.11.6", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "http"] }
|
serenity = { version = "0.11.6", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "http"] }
|
||||||
serenity_utils = "0.7.0"
|
serenity_utils = "0.7.0"
|
||||||
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
|
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
|
||||||
|
|
|
@ -4,12 +4,14 @@ use serenity::model::channel::Message;
|
||||||
use serenity::model::gateway::Ready;
|
use serenity::model::gateway::Ready;
|
||||||
use serenity::prelude::*;
|
use serenity::prelude::*;
|
||||||
use util::security::dotenv_var;
|
use util::security::dotenv_var;
|
||||||
|
use other::msg::hello;
|
||||||
|
|
||||||
mod message_handler;
|
mod message_handler;
|
||||||
use message_handler::handle;
|
use message_handler::handle;
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
mod util;
|
mod util;
|
||||||
|
mod other;
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
|
@ -44,6 +46,9 @@ impl EventHandler for Handler {
|
||||||
Ok(_) => return,
|
Ok(_) => return,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
// if ready.user.name != "MOOver Debug" {
|
||||||
|
hello(ctx.http).await;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
src/other/mod.rs
Normal file
1
src/other/mod.rs
Normal file
|
@ -0,0 +1 @@
|
||||||
|
pub mod msg;
|
23
src/other/msg.rs
Normal file
23
src/other/msg.rs
Normal 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);
|
||||||
|
};
|
||||||
|
}
|
|
@ -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();
|
|
||||||
}
|
|
Loading…
Reference in a new issue