diff --git a/src/commands/emote.rs b/src/commands/emote.rs new file mode 100644 index 0000000..223d8a3 --- /dev/null +++ b/src/commands/emote.rs @@ -0,0 +1,36 @@ +use regex::Regex; +use serenity::{ + framework::standard::{macros::command, Args, CommandError, CommandResult}, + model::channel::Message, + prelude::*, + utils::parse_emoji, +}; + +#[command] +#[aliases("e")] +fn emote(ctx: &mut Context, message: &Message, args: Args) -> CommandResult { + let input = match args.rest().trim() { + "" => { + return Err(CommandError(s!("Called without input!"))); + } + v => v, + }; + + dbg!(input); + + let re = Regex::new(r"").unwrap(); + let emojis = match re.captures(input) { + None => { + return Err(CommandError(s!("No custom emojis found in the message!"))); + } + Some(v) => v, + }; + + dbg!(&emojis); + + let url = parse_emoji(&emojis[0]).unwrap().url(); + + let _ = message.channel_id.say(&ctx.http, url); + + Ok(()) +} diff --git a/src/commands/help.rs b/src/commands/help.rs index 0c8e416..a2d2779 100644 --- a/src/commands/help.rs +++ b/src/commands/help.rs @@ -38,6 +38,11 @@ fn help(ctx: &mut Context, message: &Message) -> CommandResult { ("owo!headpat ``name``", "Headpat someone", true), ("owo!owo ``text``", "owoify input text", true), ("owo!lyrics ``name``", "Get song lyrics", true), + ( + "owo!e ``emote``", + "Get a bigger version of a custom emote", + true, + ), ("\u{200B}", "**Admin commands:**", false), ("owo!halt", "Kill the bot process", true), ("owo!status ``[args]``", "Sets the bot status", true), diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 6372d7a..a1284b1 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,6 +1,7 @@ pub mod brainfuck; pub mod define; pub mod embed; +pub mod emote; pub mod help; pub mod lyrics; pub mod pinned; diff --git a/src/main.rs b/src/main.rs index 6ab2ef1..2fd3bb2 100755 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,9 @@ mod utils; use utils::*; mod commands; -use commands::{brainfuck::*, define::*, embed::*, help::*, lyrics::*, pinned::*, ship::*}; +use commands::{ + brainfuck::*, define::*, embed::*, emote::*, help::*, lyrics::*, pinned::*, ship::*, +}; struct Handler; @@ -65,7 +67,7 @@ impl EventHandler for Handler { #[group] #[commands( init, ping, halt, servers, host, status, ship, bottom_rng, headpat, uwu, gayculator, sausage, - help, embed, define, owo, info, echo, desc, pinned, brainfuck, pfp, lyrics + help, embed, define, owo, info, echo, desc, pinned, brainfuck, pfp, lyrics, emote )] struct General;