From 4430cfe259469d57982fd1bfe93dcc9e2cd73a3f Mon Sep 17 00:00:00 2001 From: Nilstrieb Date: Tue, 1 Jun 2021 20:00:06 +0200 Subject: [PATCH] nsfw fix --- src/commands.rs | 19 +++++++++++++++++-- src/general.rs | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 9514799..5deca0a 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -10,11 +10,11 @@ use serenity::utils::{content_safe, ContentSafeOptions}; use toml::Value; use uwuifier::uwuify_str_sse; -use crate::general::{CONFIG, CONFIG_ERR, reply}; +use crate::general::{REACTION_EMOTES, CONFIG, CONFIG_ERR, reply}; use crate::LastMessageInChannel; #[group] -#[commands(say)] +#[commands(say, list)] #[description = "General widetom commands"] struct General; @@ -30,6 +30,21 @@ struct Meme; struct Admin; +#[command] +#[description("lists all the commands")] +async fn list(ctx: &Context, msg: &Message, _: Args) -> CommandResult { + msg.channel_id.send_message(&ctx.http, |msg| { + msg.embed(|e| { + e.title("Widetom reaction emotes"); + e.fields(REACTION_EMOTES.iter() + .map(|em| (em.0, format!("<:{}:{}>", em.0, em.1.0), false)) + ); + e + }) + }).await?; + Ok(()) +} + #[command] #[description("say something")] async fn say(ctx: &Context, msg: &Message, args: Args) -> CommandResult { diff --git a/src/general.rs b/src/general.rs index e89865c..0e2e528 100644 --- a/src/general.rs +++ b/src/general.rs @@ -19,7 +19,7 @@ lazy_static! { config.parse::().expect(CONFIG_ERR) }; - static ref REACTION_EMOTES: HashMap = { + pub static ref REACTION_EMOTES: HashMap = { let mut m = HashMap::new(); let emotes = CONFIG.get("emotes").expect(CONFIG_ERR);