forked from sorceress/rustcord
Add WIP owo!emote
This commit is contained in:
parent
193dfdd383
commit
e16905f821
|
@ -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"<a{0,1}:\w+:\d+>").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(())
|
||||||
|
}
|
|
@ -38,6 +38,11 @@ fn help(ctx: &mut Context, message: &Message) -> CommandResult {
|
||||||
("owo!headpat ``name``", "Headpat someone", true),
|
("owo!headpat ``name``", "Headpat someone", true),
|
||||||
("owo!owo ``text``", "owoify input text", true),
|
("owo!owo ``text``", "owoify input text", true),
|
||||||
("owo!lyrics ``name``", "Get song lyrics", 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),
|
("\u{200B}", "**Admin commands:**", false),
|
||||||
("owo!halt", "Kill the bot process", true),
|
("owo!halt", "Kill the bot process", true),
|
||||||
("owo!status ``[args]``", "Sets the bot status", true),
|
("owo!status ``[args]``", "Sets the bot status", true),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
pub mod brainfuck;
|
pub mod brainfuck;
|
||||||
pub mod define;
|
pub mod define;
|
||||||
pub mod embed;
|
pub mod embed;
|
||||||
|
pub mod emote;
|
||||||
pub mod help;
|
pub mod help;
|
||||||
pub mod lyrics;
|
pub mod lyrics;
|
||||||
pub mod pinned;
|
pub mod pinned;
|
||||||
|
|
|
@ -26,7 +26,9 @@ mod utils;
|
||||||
use utils::*;
|
use utils::*;
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
use commands::{brainfuck::*, define::*, embed::*, help::*, lyrics::*, pinned::*, ship::*};
|
use commands::{
|
||||||
|
brainfuck::*, define::*, embed::*, emote::*, help::*, lyrics::*, pinned::*, ship::*,
|
||||||
|
};
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ impl EventHandler for Handler {
|
||||||
#[group]
|
#[group]
|
||||||
#[commands(
|
#[commands(
|
||||||
init, ping, halt, servers, host, status, ship, bottom_rng, headpat, uwu, gayculator, sausage,
|
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;
|
struct General;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue