Prepared for release ver-1.0
This commit is contained in:
parent
e34df85f0c
commit
8f800c2ec4
8 changed files with 42 additions and 45 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
/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
|
||||
}
|
|
@ -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"] }
|
||||
|
|
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::http::{self, Http};
|
||||
use serenity::model::channel::Message;
|
||||
use serenity::model::gateway::Ready;
|
||||
use serenity::model::id::ChannelId;
|
||||
use serenity::prelude::*;
|
||||
use util::security::dotenv_var;
|
||||
use other::msg::hello;
|
||||
|
||||
mod util;
|
||||
mod other;
|
||||
|
||||
struct Handler;
|
||||
|
||||
|
@ -25,22 +22,9 @@ impl EventHandler for Handler {
|
|||
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
println!("{} is connected!", ready.user.name);
|
||||
// if (ready.user.name != "MOOver Debug") {
|
||||
let messages = [
|
||||
"AAAAAAAAAAAAAAAAAAAA",
|
||||
"Henlooo",
|
||||
"Good day y'all!",
|
||||
"May have crashed...",
|
||||
"MOOOooo",
|
||||
"Heyyyyy!",
|
||||
"I'm baaaaack!",
|
||||
"Whom'st have summoned the ancient one?",
|
||||
];
|
||||
|
||||
// if ready.user.name != "MOOver Debug" {
|
||||
hello(ctx.http).await;
|
||||
// }
|
||||
|
||||
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,10 +3,9 @@ use std::env;
|
|||
|
||||
pub fn dotenv_var(key: &str) -> Option<String> {
|
||||
dotenv().ok();
|
||||
let key = "TOKEN";
|
||||
|
||||
match env::var(key) {
|
||||
Ok(val) => return Some(val),
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue