12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Linq;
- using System.Threading.Tasks;
- using MafiaTelegramBot.DataBase.EntityDao;
- using MafiaTelegramBot.Resources;
- using Telegram.Bot.Types;
- namespace MafiaTelegramBot.Models.Commands
- {
- public class ShowProfileCommand : Command
- {
- protected override string Name => keyboard.show_profile;
- protected override async Task<Message> Execute(Update update)
- {
- var user = await UserDao.GetPlayerById(UserId);
- var rolesList = Enum.GetValues(typeof(Roles)).Cast<Roles>().ToList();
- rolesList.Remove(Roles.None);
- rolesList.Remove(Roles.All);
- var allStatsRow = user.Statistics[Roles.All];
- var message =
- $"__*{strings.statistics_for} _{user.NickName}_*__\n" +
- $"{strings.games_count} {allStatsRow.Games}\n" +
- $"{strings.wins_count} {allStatsRow.Wins}\n" +
- $"{strings.winrate} {(int)(allStatsRow.GetWinrate()*100)}%\n" +
- $"{strings.rate} {user.RankNumber}";
- return await Bot.SendWithMarkdown2(ChatId, message, Keyboard.ProfileKeyboard(UserId));
-
- }
- }
- }
|