Prepared for release ver-1.0
This commit is contained in:
parent
1088a1356a
commit
b1a7e2ab96
9 changed files with 58 additions and 835 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
/target
|
/target
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
/src/.*
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rust-analyzer.linkedProjects": [
|
||||||
|
"./Cargo.toml"
|
||||||
|
],
|
||||||
|
"rust-analyzer.showUnlinkedFileNotification": false
|
||||||
|
}
|
806
Cargo.lock
generated
806
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -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"] }
|
||||||
|
|
24
src/main.rs
24
src/main.rs
|
@ -1,15 +1,12 @@
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use poise::serenity_prelude::GuildChannel;
|
|
||||||
use serenity::async_trait;
|
use serenity::async_trait;
|
||||||
use serenity::http::{self, Http};
|
|
||||||
use serenity::model::channel::Message;
|
use serenity::model::channel::Message;
|
||||||
use serenity::model::gateway::Ready;
|
use serenity::model::gateway::Ready;
|
||||||
use serenity::model::id::ChannelId;
|
|
||||||
use serenity::prelude::*;
|
use serenity::prelude::*;
|
||||||
use util::security::dotenv_var;
|
use util::security::dotenv_var;
|
||||||
|
use other::msg::hello;
|
||||||
|
|
||||||
mod util;
|
mod util;
|
||||||
|
mod other;
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
|
@ -25,22 +22,9 @@ impl EventHandler for Handler {
|
||||||
|
|
||||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||||
println!("{} is connected!", ready.user.name);
|
println!("{} is connected!", ready.user.name);
|
||||||
// if (ready.user.name != "MOOver Debug") {
|
// if ready.user.name != "MOOver Debug" {
|
||||||
let messages = [
|
hello(ctx.http).await;
|
||||||
"AAAAAAAAAAAAAAAAAAAA",
|
|
||||||
"Henlooo",
|
|
||||||
"Good day y'all!",
|
|
||||||
"May have crashed...",
|
|
||||||
"MOOOooo",
|
|
||||||
"Heyyyyy!",
|
|
||||||
"I'm baaaaack!",
|
|
||||||
"Whom'st have summoned the ancient one?",
|
|
||||||
];
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let channel = ctx.http.get_channel(780439236867653635).await.unwrap();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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();
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ use std::env;
|
||||||
|
|
||||||
pub fn dotenv_var(key: &str) -> Option<String> {
|
pub fn dotenv_var(key: &str) -> Option<String> {
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
let key = "TOKEN";
|
|
||||||
|
|
||||||
match env::var(key) {
|
match env::var(key) {
|
||||||
Ok(val) => return Some(val),
|
Ok(val) => return Some(val),
|
||||||
|
|
Loading…
Reference in a new issue