|
@@ -0,0 +1,30 @@
|
|
|
+using System;
|
|
|
+using System.Linq;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using MafiaTelegramBot.DataBase.EntityDao;
|
|
|
+using MafiaTelegramBot.Resources;
|
|
|
+using Telegram.Bot.Types;
|
|
|
+
|
|
|
+namespace MafiaTelegramBot.Models.Inlines
|
|
|
+{
|
|
|
+ public class BackToProfileQuery : Query
|
|
|
+ {
|
|
|
+ protected override Callback Name => Callback.BackToProfile;
|
|
|
+ protected override async Task<Message> Execute(Update update)
|
|
|
+ {
|
|
|
+ await DeletePreviousMessage(ChatId, update.CallbackQuery.Message.MessageId);
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|