fix for alias

This commit is contained in:
jellywx 2021-05-13 20:20:53 +01:00
parent 2346c2e978
commit 9109250fe8
2 changed files with 4 additions and 4 deletions

View File

@ -28,10 +28,8 @@ use crate::{
FrameworkCtx, PopularTimezones, FrameworkCtx, PopularTimezones,
}; };
#[cfg(feature = "prefix-cache")]
use crate::PrefixCache;
use crate::models::CtxGuildData; use crate::models::CtxGuildData;
use serenity::model::id::MessageId;
use std::{collections::HashMap, iter, time::Duration}; use std::{collections::HashMap, iter, time::Duration};
#[command] #[command]
@ -670,6 +668,7 @@ SELECT command FROM command_aliases WHERE guild_id = (SELECT id FROM guilds WHER
let mut new_msg = msg.clone(); let mut new_msg = msg.clone();
new_msg.content = format!("<@{}> {}", &ctx.cache.current_user_id().await, row.command); new_msg.content = format!("<@{}> {}", &ctx.cache.current_user_id().await, row.command);
new_msg.id = MessageId(0);
framework.dispatch(ctx.clone(), new_msg).await; framework.dispatch(ctx.clone(), new_msg).await;
}, },

View File

@ -22,6 +22,7 @@ use std::{collections::HashMap, fmt};
use crate::language_manager::LanguageManager; use crate::language_manager::LanguageManager;
use crate::models::{CtxGuildData, GuildData, UserData}; use crate::models::{CtxGuildData, GuildData, UserData};
use crate::{models::ChannelData, CurrentlyExecuting, SQLPool}; use crate::{models::ChannelData, CurrentlyExecuting, SQLPool};
use serenity::model::id::MessageId;
use std::time::Duration; use std::time::Duration;
type CommandFn = for<'fut> fn(&'fut Context, &'fut Message, String) -> BoxFuture<'fut, ()>; 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); lock.insert(msg.author.id);
} }
if !user_is_executing { if !user_is_executing || msg.id == MessageId(0) {
// Guild Command // Guild Command
if let (Some(guild), Some(Channel::Guild(channel))) = if let (Some(guild), Some(Channel::Guild(channel))) =
(msg.guild(&ctx).await, msg.channel(&ctx).await) (msg.guild(&ctx).await, msg.channel(&ctx).await)