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