diff --git a/Cargo.toml b/Cargo.toml index 1a25f60..b2d1cf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustcord" -version = "0.5.3" +version = "0.7.0" authors = [" <@protonmail.com>"] [dependencies] diff --git a/src/main.rs b/src/main.rs index 91c8ed0..5e9217b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,12 +45,14 @@ fn main() { .cmd("halt", halt) .cmd("help", help) .cmd("info", info) + .cmd("ping", ping) .cmd("list_srv", list_srv) .command("compare_bot", |c| { c .cmd(compare_bot) .known_as("compare bot") }) + .cmd("ship", ship) ); // start listening for events by starting a single shard @@ -63,6 +65,10 @@ command!(init(_ctx, message) { let _ = message.channel_id.say("The Discordinator9000 is ready to kick yer butts!"); }); +command!(ping(_ctx, message) { + let _ = message.reply("Pong!"); +}); + command!(halt(ctx, message) { if message.author.id == 254310746450690048 { use serenity::model::user::OnlineStatus; @@ -94,6 +100,41 @@ command!(list_srv(_ctx, message) { } }); +command!(ship(_ctx, message, args) { +use std::collections::hash_map::DefaultHasher; +use std::hash::{Hash, Hasher}; + + let first = calculate_hash(&args.single::().unwrap()); + let second = calculate_hash(&args.single::().unwrap()); + let mut slider = String::new(); + let res = (first % second) / 100000000000000000; + + //let _ = message.channel_id.say(format!(":heart: {}%", res)); + let mut num = 0; + while num < res / 10 { + slider.push('▬'); + num += 1; + } + slider.push_str(":heart:"); + num = 0; + while num < (10 - res / 10) { + slider.push('▬'); + num += 1; + } + let _ = message.channel_id.send_message(|m| m + .embed(|e| e + .title(format!("{}%", res)) + .description(slider) + .color(0xff00ce) + )); + + fn calculate_hash(t: &T) -> u64 { + let mut s = DefaultHasher::new(); + t.hash(&mut s); + s.finish() + } +}); + command!(gayculator(_ctx, message, args) { if message.author.id != 191948420141809665 { let number_32: i32 = args.trim().parse() @@ -108,8 +149,8 @@ if message.author.id != 191948420141809665 { .embed(|e| e .title("Gayness level:") .description(result) - .color(0xff00f9)) - ); + .color(0xff00f9) + )); } }); @@ -141,11 +182,14 @@ command!(help(_ctx, message) { .title("Availble commands:") .description("All commands are case-insensitive") .fields(vec![ + ("OwO init", "Introduce me", false), + ("OwO ping", "Pong", false), ("OwO waffle", "Join the **waffle dongle** cult!", false), ("OwO sausage", "Join the **sausage dongle** cult!", false), ("OwO help", "Help the fellow humanz!", false), ("OwO info", "Show information about me!", false), - ("OwO compare_bot", "Compare me to other robots!", false), + ("OwO compare_bot ``bot's name``", "Compare me to other robots!", false), + ("OwO ship ``name 1`` ``name 2``", "*shipping intensifies*", false), ("Admin commands:", "\u{200B}", true), ("OwO halt", "shut me down", false), ("OwO list_srv", "list my servers", false) diff --git a/target/release/rustcord b/target/release/rustcord index df37911..ebea4b5 100755 Binary files a/target/release/rustcord and b/target/release/rustcord differ