public async Task <(bool result, string response)> Process(SlackTextCommand cmd) { if (_cfg.Value.Admins.Contains(cmd.UserId)) { var list = await _list.ListPromosAsync(true); var response = list.Count > 0 ? string.Join("\n", list.Where(a => !a.Activated).Select(a => $"`{a.Code}` ={a.Amount}")) : "Нет активных промокодов"; return(true, response); } return(false, "oops"); }
public async Task <(bool result, string response)> Process(SlackTextCommand cmd) { if (_cfg.Value.Admins.Contains(cmd.UserId)) { var list = await _list.ListPromosAsync(false); StringBuilder sb = new StringBuilder(); foreach (var code in list.OrderBy(a => a.ActivatedOn)) { sb.AppendLine($"{code.Code} activated={code.Activated}, on {code.ActivatedOn}, <@{code.ToUserId}>"); } return(true, sb.ToString()); } return(false, "oops"); }