RoomSettingsCommand.cs 892 B

123456789101112131415161718192021222324
  1. using System.Threading.Tasks;
  2. using MafiaTelegramBot.Controllers;
  3. using MafiaTelegramBot.DataBase.EntityDao;
  4. using MafiaTelegramBot.Game;
  5. using MafiaTelegramBot.Resources;
  6. using Telegram.Bot.Types;
  7. namespace MafiaTelegramBot.Models.Commands
  8. {
  9. public class RoomSettingsCommand : Command
  10. {
  11. protected override string Name => keyboard.room_settings;
  12. protected override async Task<Message> Execute(Update update)
  13. {
  14. var user = await UserDao.GetPlayerById(UserId);
  15. var roomKey = RoomEncrypter.GetCode(user.GetRoomName());
  16. var room = RoomController.GetRoom(roomKey);
  17. var status = room.TimerEnabled ? strings.enabled : strings.disabled;
  18. return await Bot.SendWithMarkdown2(ChatId, strings.what_settings,
  19. Keyboard.SettingsRoomKeyboard(UserId, $"{strings.timer}: {status}"));
  20. }
  21. }
  22. }