123456789101112131415161718192021222324 |
- using System.Threading.Tasks;
- using MafiaTelegramBot.Controllers;
- using MafiaTelegramBot.DataBase;
- using MafiaTelegramBot.DataBase.EntityDao;
- using MafiaTelegramBot.Resources;
- using Telegram.Bot.Types;
- namespace MafiaTelegramBot.Models.Commands
- {
- public class LeaveCommand : Command
- {
- protected override string Name => keyboard.leave;
- protected override async Task<Message> Execute(Update update)
- {
- var user = await UserDao.GetPlayerById(UserId);
- var roomName = user.GetRoomName();
- var resultCode = await RoomController.LeaveFromGame(user);
- return resultCode == ResultCode.CodeOk
- ? await Bot.SendWithMarkdown2(ChatId, $"{strings.leave_from_game} _*{roomName}*_", Keyboards.MainMenu)
- : await Utilities.GetResultCodeMessage(resultCode, ChatId);
- }
- }
- }
|