diff --git a/Cargo.lock b/Cargo.lock index 3278ce2..5221a3f 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "adler32" version = "1.0.4" @@ -871,9 +873,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.4.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" @@ -1274,7 +1276,7 @@ version = "2.0.0" dependencies = [ "brainfrick", "colored", - "lazy_static 1.4.0", + "once_cell", "owoify", "percent-encoding 2.1.0", "rand 0.8.4", diff --git a/Cargo.toml b/Cargo.toml index 6d1561d..0979e70 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,11 +13,11 @@ toml = "0.5.8" sys-info = "0.9.0" urbandict = "0.2.0" owoify = "0.1.5" -lazy_static = "1.4.0" colored = "2.0.0" brainfrick = "1.1.2" percent-encoding = "2.1.0" regex = "1.5.4" +once_cell = "1.8.0" [patch.crates-io] openssl = { git = "https://github.com/ishitatsuyuki/rust-openssl", branch = "0.9.x" } @@ -33,4 +33,4 @@ features = ["blocking", "json"] [dependencies.tokio] version = "1.7.1" -features = ["macros", "rt-multi-thread"] \ No newline at end of file +features = ["macros", "rt-multi-thread"] diff --git a/src/main.rs b/src/main.rs index 5b80c30..f1b882a 100755 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,8 @@ #![allow(clippy::unreadable_literal)] #![allow(clippy::cmp_owned)] -#[macro_use] -extern crate lazy_static; - use colored::*; +use once_cell::sync::Lazy; use rand::Rng; use serenity::{ async_trait, @@ -125,18 +123,15 @@ async fn after(ctx: &Context, msg: &Message, command_name: &str, command_result: )] struct General; -lazy_static! { - static ref OWNERS: std::vec::Vec = - /* Agatha's Id Julia's Id */ - vec![UserId(254310746450690048), UserId(687740609703706630)]; -} +static OWNERS: Lazy> = + Lazy::new(|| vec![UserId(254310746450690048), UserId(687740609703706630)]); #[tokio::main] async fn main() { let framework = StandardFramework::new() .configure(|c| { c.with_whitespace(true) - .owners(OWNERS.clone().into_iter().collect()) + .owners(OWNERS.iter().cloned().collect()) .prefixes(vec!["owo!", "OwO!", "aga"]) .no_dm_prefix(true) .case_insensitivity(true) @@ -173,7 +168,7 @@ async fn main() { async fn owner_check( _: &Context, msg: &Message, _: &mut Args, _: &CommandOptions, ) -> Result<(), Reason> { - if OWNERS.clone().contains(&msg.author.id) { + if OWNERS.contains(&msg.author.id) { Ok(()) } else { Err(Reason::Unknown) @@ -485,7 +480,7 @@ async fn info(ctx: &Context, message: &Message, args: Args) -> CommandResult { let num = ctx.cache.guilds().await.len(); // get developer's username - let aganame = OWNERS.clone()[0].to_user(ctx.http.clone()).await?.tag(); + let aganame = OWNERS[0].to_user(ctx.http.clone()).await?.tag(); let _ = message.channel_id.send_message(&ctx.http, |m| m .embed(|e| e .title("Discordinator9000's info:")