using System.Collections.Generic; using Perfusion; using JetKarmaBot.Services.Handling; using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using JetKarmaBot.Models; using JetBotLib; namespace JetKarmaBot.Commands { public class CurrenciesCommand : IChatCommand { [Inject] Localization Locale { get; set; } public IReadOnlyCollection Names => new[] { "currencies", "awardtypes" }; public string Description => "Shows all award types"; public string DescriptionID => "jetkarmabot.currencies.help"; public IReadOnlyCollection Arguments => new ChatCommandArgument[] { }; public async Task Execute(RequestContext ctx) { var db = ctx.GetFeature(); var currentLocale = ctx.GetFeature(); await ctx.SendMessage( currentLocale["jetkarmabot.currencies.listtext"] + "\n" + string.Join("\n", (await db.AwardTypes.ToListAsync()) .Select(x => $"{x.Symbol} ({x.CommandName}) {currentLocale["jetkarmabot.awardtypes.nominative." + x.CommandName]}"))); return true; } } }