diff --git a/Cargo.lock b/Cargo.lock index 4cb27b8..4881f0d 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1032,6 +1032,7 @@ dependencies = [ name = "rustcord" version = "0.3.0" dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "owoify 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index d498436..127d20c 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ toml = "0.5.6" sys-info = "0.6.0" urbandict = "0.2.0" owoify = "0.1.5" +lazy_static = "1.4.0" [patch.crates-io] openssl = { git = "https://github.com/ishitatsuyuki/rust-openssl", branch = "0.9.x" } diff --git a/src/main.rs b/src/main.rs index ee5ee23..f039d75 100755 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,8 @@ #![allow(clippy::unreadable_literal)] +#[macro_use] +extern crate lazy_static; + use rand::Rng; use serenity::{ client::Client, @@ -40,6 +43,11 @@ impl EventHandler for Handler { )] struct General; +lazy_static! { + static ref OWNERS: std::vec::Vec = + vec![UserId(254310746450690048), UserId(687740609703706630)]; +} + // Calculates hash of a type that implements Hash fn calculate_hash(t: &T) -> u64 { let mut s = DefaultHasher::new(); @@ -55,11 +63,7 @@ fn main() { StandardFramework::new() .configure(|c| { c.with_whitespace(true) - .owners( - vec![UserId(254310746450690048), UserId(687740609703706630)] - .into_iter() - .collect(), - ) + .owners(OWNERS.clone().into_iter().collect()) .prefixes(vec!["owo ", "OwO "]) .no_dm_prefix(true) .case_insensitivity(true) @@ -85,7 +89,7 @@ fn main() { #[check] #[name = "Owner"] fn owner_check(_: &mut Context, msg: &Message, _: &mut Args, _: &CommandOptions) -> CheckResult { - if msg.author.id == 254310746450690048 || msg.author.id == 687740609703706630 { + if OWNERS.clone().contains(&msg.author.id) { CheckResult::Success } else { CheckResult::Failure(Reason::Unknown)