public static void StartGame(Message msg, string[] args) { BigTwo game = Bot.GetGameByChatId(msg.Chat.Id); if (game == null) { if (Program.MaintMode) { Bot.Send(msg.Chat.Id, GetTranslation("CantStartGameMaintenance", GetLanguage(msg.Chat.Id))); return; } // see if he started bot try { Bot.Api.SendChatActionAsync(msg.From.Id, ChatAction.Typing).Wait(); Bot.AddGame(new BigTwo(msg.Chat.Id, msg.From, msg.Chat.Title, msg.Chat.Username)); } catch (Exception e) { // no he did not Bot.Send(msg.Chat.Id, GetTranslation("NotStartedBot", GetLanguage(msg.From.Id), msg.From.GetName()), GenerateStartMe(msg.From.Id)); } } else { game.HandleMessage(msg); // msg.Reply(GetTranslation("ExistingGame", GetLanguage(msg.Chat.Id))); } }
public static void ForceStart(Message msg, string[] args) { BigTwo game = Bot.GetGameByChatId(msg.Chat.Id); if (game == null) { return; } else { game.HandleMessage(msg); } }
public static void RemoveGame(BigTwo game) { Program.Games.Remove(game); }
public static void AddGame(BigTwo game) { Program.Games.Add(game); }