From 9109250fe8ba5e32fb26fc99ce45e03bd29da75f Mon Sep 17 00:00:00 2001 From: jellywx Date: Thu, 13 May 2021 20:20:53 +0100 Subject: [PATCH] fix for alias --- src/commands/moderation_cmds.rs | 5 ++--- src/framework.rs | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/moderation_cmds.rs b/src/commands/moderation_cmds.rs index cd29fce..188c489 100644 --- a/src/commands/moderation_cmds.rs +++ b/src/commands/moderation_cmds.rs @@ -28,10 +28,8 @@ use crate::{ FrameworkCtx, PopularTimezones, }; -#[cfg(feature = "prefix-cache")] -use crate::PrefixCache; - use crate::models::CtxGuildData; +use serenity::model::id::MessageId; use std::{collections::HashMap, iter, time::Duration}; #[command] @@ -670,6 +668,7 @@ SELECT command FROM command_aliases WHERE guild_id = (SELECT id FROM guilds WHER let mut new_msg = msg.clone(); new_msg.content = format!("<@{}> {}", &ctx.cache.current_user_id().await, row.command); + new_msg.id = MessageId(0); framework.dispatch(ctx.clone(), new_msg).await; }, diff --git a/src/framework.rs b/src/framework.rs index 465235e..6c0d92c 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -22,6 +22,7 @@ use std::{collections::HashMap, fmt}; use crate::language_manager::LanguageManager; use crate::models::{CtxGuildData, GuildData, UserData}; use crate::{models::ChannelData, CurrentlyExecuting, SQLPool}; +use serenity::model::id::MessageId; use std::time::Duration; type CommandFn = for<'fut> fn(&'fut Context, &'fut Message, String) -> BoxFuture<'fut, ()>; @@ -364,7 +365,7 @@ impl Framework for RegexFramework { lock.insert(msg.author.id); } - if !user_is_executing { + if !user_is_executing || msg.id == MessageId(0) { // Guild Command if let (Some(guild), Some(Channel::Guild(channel))) = (msg.guild(&ctx).await, msg.channel(&ctx).await)