StartCommand.cs 970 B

12345678910111213141516171819202122232425262728
  1. using System.Threading.Tasks;
  2. using Telegram.Bot;
  3. using Telegram.Bot.Types;
  4. using Telegram.Bot.Types.Enums;
  5. using Telegram.Bot.Types.ReplyMarkups;
  6. namespace MafiaTelegramBot.Models.Commands
  7. {
  8. public class StartCommand : Command
  9. {
  10. protected override string Name => "/start";
  11. protected override async Task<Message> Execute(Update update, TelegramBotClient client)
  12. {
  13. await Bot.Get().SendChatActionAsync(update.Message.Chat.Id, ChatAction.Typing);
  14. ReplyKeyboardMarkup keyboard = new(
  15. new[]
  16. {
  17. new KeyboardButton[] {strings.create_game},
  18. new KeyboardButton[] {strings.connect_game},
  19. new KeyboardButton[] {strings.show_profile}
  20. },
  21. true
  22. );
  23. return await Bot.Get().SendTextMessageAsync(update.Message.Chat.Id, strings.start_message, replyMarkup: keyboard);
  24. }
  25. }
  26. }