public async Task PrintCustomCommands(CustomCommandsCommand command, Contexts contexts) { var getCustomCommandsQuery = new GetCustomCommandsQuery(contexts.Server.Id); var customCommands = await this._queryBus.ExecuteAsync(getCustomCommandsQuery); var messagesServices = this._messagesServiceFactory.Create(contexts); await messagesServices.SendEmbedMessage(this._responsesService.CustomCommandsHeader(), string.Empty, customCommands.CustomCommands.Select(x => new KeyValuePair <string, string>(x.CommandFullName, x.CustomTemplateRegex))); }
public async Task <List <CustomCommand> > GetCustomCommands() { var query = new GetCustomCommandsQuery(); var commands = await this._queryBus.ExecuteAsync(query); var mapped = commands.CustomCommands.Select(x => { var regex = new Regex(x.CustomTemplateRegex.Replace(@"\\", @"\"), RegexOptions.Compiled | RegexOptions.IgnoreCase); return(new CustomCommand(x.CommandFullName, regex, x.ServerId)); }).ToList(); return(mapped); }