|
@@ -4,22 +4,33 @@ using MafiaTelegramBot.DataBase;
|
|
|
using Telegram.Bot;
|
|
|
using Telegram.Bot.Types;
|
|
|
using Telegram.Bot.Types.Enums;
|
|
|
+using Telegram.Bot.Types.ReplyMarkups;
|
|
|
|
|
|
namespace MafiaTelegramBot.Models.Commands
|
|
|
{
|
|
|
public class ShowProfileCommand : Command
|
|
|
{
|
|
|
protected override string Name => strings.show_profile;
|
|
|
+
|
|
|
protected override async Task<Message> Execute(Update update, TelegramBotClient client)
|
|
|
{
|
|
|
- await Bot.Get().SendChatActionAsync(update.Message.Chat.Id, ChatAction.Typing);
|
|
|
+ var chatId = update.Message.Chat.Id;
|
|
|
+ await Bot.Get().SendChatActionAsync(chatId, ChatAction.Typing);
|
|
|
var user = await UserDao.GetUserById(update.Message.From.Id);
|
|
|
var winRate = user.Games < 1 ? 0.0 : Convert.ToDouble(user.Wins) / Convert.ToDouble(user.Games);
|
|
|
- var message = $"__*{strings.statistics_for} _{user.Username}_*__\n" +
|
|
|
- $"{strings.games_count} {user.Games}\n" +
|
|
|
- $"{strings.wins_count} {user.Wins}\n" +
|
|
|
- $"{strings.winrate} {winRate}\n";
|
|
|
- return await Bot.Get().SendTextMessageAsync(update.Message.Chat.Id, message, ParseMode.MarkdownV2);
|
|
|
+ var message =
|
|
|
+ $"__*{strings.statistics_for} _{user.Username}_*__\n" +
|
|
|
+ $"{strings.games_count} {user.Games}\n" +
|
|
|
+ $"{strings.wins_count} {user.Wins}\n" +
|
|
|
+ $"{strings.winrate} {winRate}%\n";
|
|
|
+ var inlineKeyboard = new InlineKeyboardMarkup(new[]
|
|
|
+ {
|
|
|
+ new[] {InlineKeyboardButton.WithCallbackData(strings.shop, strings.shop_callback)},
|
|
|
+ new[] {InlineKeyboardButton.WithCallbackData(strings.my_roles, strings.my_roles_callback)},
|
|
|
+ new[] {InlineKeyboardButton.WithCallbackData(strings.settings, strings.settings_callback)}
|
|
|
+ });
|
|
|
+ return await Bot.Get()
|
|
|
+ .SendTextMessageAsync(chatId, message, ParseMode.MarkdownV2, replyMarkup: inlineKeyboard);
|
|
|
}
|
|
|
}
|
|
|
}
|