Update all dependencies, refactor some of the code;
Fix animated emotes displaying as png
This commit is contained in:
parent
5b738af0a6
commit
9563b32eb9
|
@ -0,0 +1 @@
|
||||||
|
fn_args_layout = "Compressed"
|
File diff suppressed because it is too large
Load Diff
16
Cargo.toml
16
Cargo.toml
|
@ -7,9 +7,9 @@ edition = "2018"
|
||||||
# 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]
|
||||||
serenity = "0.9.1"
|
serenity = "0.10.2"
|
||||||
rand = "0.7.3"
|
rand = "0.8.2"
|
||||||
toml = "0.5.7"
|
toml = "0.5.8"
|
||||||
sys-info = "0.7.0"
|
sys-info = "0.7.0"
|
||||||
urbandict = "0.2.0"
|
urbandict = "0.2.0"
|
||||||
owoify = "0.1.5"
|
owoify = "0.1.5"
|
||||||
|
@ -17,20 +17,20 @@ 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.4.2"
|
regex = "1.4.3"
|
||||||
|
|
||||||
[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" }
|
||||||
|
|
||||||
[dependencies.serde]
|
[dependencies.serde]
|
||||||
version = "1.0.117"
|
version = "1.0.118"
|
||||||
features = ["derive"]
|
features = ["derive"]
|
||||||
|
|
||||||
[dependencies.reqwest]
|
[dependencies.reqwest]
|
||||||
version = "0.10.9"
|
version = "0.10.10"
|
||||||
features = ["blocking", "json"]
|
features = ["blocking", "json"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies.tokio]
|
[dependencies.tokio]
|
||||||
version = "0.2.23"
|
version = "1.1.0"
|
||||||
features = ["macros"]
|
features = ["macros", "rt-multi-thread"]
|
|
@ -13,7 +13,7 @@ async fn ship(ctx: &Context, message: &Message, args: Args) -> CommandResult {
|
||||||
// Get input names
|
// Get input names
|
||||||
let names: String = args.rest().trim().to_string();
|
let names: String = args.rest().trim().to_string();
|
||||||
// Calculate compatibility based on hash
|
// Calculate compatibility based on hash
|
||||||
let compat: u64 = StdRng::seed_from_u64(calculate_hash(&names)).gen_range(50, 100);
|
let compat: u64 = StdRng::seed_from_u64(calculate_hash(&names)).gen_range(50..100);
|
||||||
|
|
||||||
// Initialize a bar to display compatibility percentage
|
// Initialize a bar to display compatibility percentage
|
||||||
let mut compbar = String::from("----------");
|
let mut compbar = String::from("----------");
|
||||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -14,7 +14,7 @@ use serenity::{
|
||||||
},
|
},
|
||||||
framework::standard::{
|
framework::standard::{
|
||||||
macros::{check, command, group, hook},
|
macros::{check, command, group, hook},
|
||||||
Args, CheckResult, CommandOptions, CommandResult, DispatchError, Reason, StandardFramework,
|
Args, CommandOptions, CommandResult, DispatchError, Reason, StandardFramework,
|
||||||
},
|
},
|
||||||
model::{
|
model::{
|
||||||
channel::{Message, ReactionType},
|
channel::{Message, ReactionType},
|
||||||
|
@ -170,18 +170,25 @@ async fn main() {
|
||||||
|
|
||||||
#[check]
|
#[check]
|
||||||
#[name = "Owner"]
|
#[name = "Owner"]
|
||||||
async fn owner_check(_: &Context, msg: &Message, _: &mut Args, _: &CommandOptions) -> CheckResult {
|
async fn owner_check(
|
||||||
|
_: &Context, msg: &Message, _: &mut Args, _: &CommandOptions,
|
||||||
|
) -> Result<(), Reason> {
|
||||||
if OWNERS.clone().contains(&msg.author.id) {
|
if OWNERS.clone().contains(&msg.author.id) {
|
||||||
CheckResult::Success
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
CheckResult::Failure(Reason::Unknown)
|
Err(Reason::Unknown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[check]
|
#[check]
|
||||||
#[name = "Server"]
|
#[name = "Server"]
|
||||||
async fn server_check(_: &Context, msg: &Message, _: &mut Args, _: &CommandOptions) -> CheckResult {
|
async fn server_check(
|
||||||
(msg.guild_id == Some(serenity::model::id::GuildId(687011389294116875))).into()
|
_: &Context, msg: &Message, _: &mut Args, _: &CommandOptions,
|
||||||
|
) -> Result<(), Reason> {
|
||||||
|
match msg.guild_id == Some(serenity::model::id::GuildId(687011389294116875)) {
|
||||||
|
true => Ok(()),
|
||||||
|
false => Err(Reason::Unknown),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[command]
|
#[command]
|
||||||
|
@ -191,7 +198,7 @@ async fn init(ctx: &Context, message: &Message) -> CommandResult {
|
||||||
"Nyaa~!",
|
"Nyaa~!",
|
||||||
"Hewwo uwu",
|
"Hewwo uwu",
|
||||||
];
|
];
|
||||||
let num = rand::thread_rng().gen_range(0, responses.len());
|
let num = rand::thread_rng().gen_range(0..responses.len());
|
||||||
let _ = message.channel_id.say(&ctx.http, responses[num]).await;
|
let _ = message.channel_id.say(&ctx.http, responses[num]).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -354,7 +361,7 @@ async fn bottom_rng(ctx: &Context, message: &Message, mut args: Args) -> Command
|
||||||
for msg in messages {
|
for msg in messages {
|
||||||
input += &format!("{} ", msg.content);
|
input += &format!("{} ", msg.content);
|
||||||
}
|
}
|
||||||
let result: u64 = StdRng::seed_from_u64(calculate_hash(&input)).gen_range(0, 100);
|
let result: u64 = StdRng::seed_from_u64(calculate_hash(&input)).gen_range(0..100);
|
||||||
let _ = message
|
let _ = message
|
||||||
.channel_id
|
.channel_id
|
||||||
.send_message(&ctx.http, |m| {
|
.send_message(&ctx.http, |m| {
|
||||||
|
@ -419,7 +426,7 @@ async fn uwu(ctx: &Context, message: &Message) -> CommandResult {
|
||||||
"https://preview.redd.it/fcfrmarhj9s41.jpg?width=640&crop=smart&auto=webp&s=5a4ff9a471dca7cad61b8e56bc65876ef083304a",
|
"https://preview.redd.it/fcfrmarhj9s41.jpg?width=640&crop=smart&auto=webp&s=5a4ff9a471dca7cad61b8e56bc65876ef083304a",
|
||||||
"https://i.redd.it/ifwsmbme48q41.jpg"
|
"https://i.redd.it/ifwsmbme48q41.jpg"
|
||||||
];
|
];
|
||||||
let num = rand::thread_rng().gen_range(0, images.len());
|
let num = rand::thread_rng().gen_range(0..images.len());
|
||||||
let _ = message
|
let _ = message
|
||||||
.channel_id
|
.channel_id
|
||||||
.send_message(&ctx.http, |m| {
|
.send_message(&ctx.http, |m| {
|
||||||
|
|
Loading…
Reference in New Issue