CreateGameCommand.cs 894 B

12345678910111213141516171819202122
  1. using System.Threading.Tasks;
  2. using MafiaTelegramBot.DataBase;
  3. using MafiaTelegramBot.Resources;
  4. using Telegram.Bot.Types;
  5. namespace MafiaTelegramBot.Models.Commands
  6. {
  7. public class CreateGameCommand : Command
  8. {
  9. protected override string Name => keyboard.create_game;
  10. protected override async Task<Message> Execute(Update update)
  11. {
  12. var user = await UserDao.GetUserById(UserId);
  13. await Bot.SendStickerWithoutPackAsync(ChatId, "https://github.com/TelegramBots/book/raw/master/src/docs/sticker-fred.webp");
  14. if (user.GetRoomKey() != "")
  15. return await Bot.SendWithMarkdown2(ChatId, strings.user_already_in_game);
  16. return await Bot.SendWithMarkdown2(ChatId, strings.choose_type_room,
  17. Keyboards.RoomTypeKeyboard(UserId, Callback.MakePrivateRoom, Callback.MakePublicRoom));
  18. }
  19. }
  20. }