using Discord.WebSocket; using Managing.Application.Abstractions.Services; using Managing.Domain.Statistics; namespace Managing.Infrastructure.Messengers.Discord; public static class SlashCommands { public static async Task HandleLeaderboardCommand(IServiceProvider service, SocketSlashCommand command) { var statisticService = (IStatisticService)service.GetService(typeof(IStatisticService)); var traders = statisticService.GetBestTraders(); await command.FollowupAsync(embed: DiscordHelpers.GetTradersEmbed(traders, "Leaderboard"), ephemeral: true); } public static async Task HandleNoobiesboardCommand(IServiceProvider service, SocketSlashCommand command) { var statisticService = (IStatisticService)service.GetService(typeof(IStatisticService)); var traders = statisticService.GetBadTraders(); await command.FollowupAsync(embed: DiscordHelpers.GetTradersEmbed(traders, "Noobiesboard"), ephemeral: true); } public static async Task HandleLeadboardPositionCommand(IServiceProvider service, SocketSlashCommand command) { var statisticService = (IStatisticService)service.GetService(typeof(IStatisticService)); var trades = await statisticService.GetLeadboardPositons(); await command.FollowupAsync(embed: DiscordHelpers.GetTradesEmbed(trades, "Leaderboard Open position"), ephemeral: true); } public static async Task HandleFundingRateCommand(IServiceProvider service, SocketSlashCommand command) { var statisticService = (IStatisticService)service.GetService(typeof(IStatisticService)); List fundingRates = await statisticService.GetFundingRates(); await command.FollowupAsync( embed: DiscordHelpers.GetFundingRatesEmbed(fundingRates, "Leaderboard Open position"), ephemeral: true); } }