예제 #1
0
        public static async Task <bool> TryExecuteAliasAsync(SocketCommandContext context)
        {
            var    config         = DataManager.AllGuildData[context.Guild.Id].Main;
            string messageContent = context.Message.Content;

            var aliasesFound = config.AliasesDictionary.Where(a =>
                                                              messageContent.StartsWithWord(a.Key));

            if (aliasesFound.Any())
            {
                var aliasToExecute = aliasesFound.First();

                await BotService.ExecuteCommandAsync(
                    context,
                    aliasToExecute.Value + messageContent.Replace(aliasToExecute.Key, string.Empty, true, null));

                return(true);
            }

            return(false);
        }