protected override TelegramBotReply HandleMessage(TelegramBot.TelegramBot bot, Message m, MessageHandlerType type) { GameRegistry.Game game; if (!GameRegistry.IsInGame(m.From, out game)) return Message(m, "You are not in a game"); if (game.Host != m.From) return Message(m, "Only the host has access to this command"); var flow = new PickPlayerFlow(game, onPlayerPicked); m.From.MessageFlow = new MessageFlow(m.From, new FlowObject { Handler = flow }); return Message(m, "Who may view someone's membership", replyMarkup: flow.GetKeyboard()); }
private async Task<TelegramBotReply> onPlayerPicked(User u, TelegramBot.TelegramBot bot, Message m, GameRegistry.Game game) { const string viewMembership = "is picking someone to view his/her membership"; var flowObj = new PickPlayerFlow(game, onPickedMembershipTarget); if (u == m.From) { await AnnounceMessage(u, bot, viewMembership); m.From.MessageFlow = new MessageFlow(u, new FlowObject { Handler = flowObj }); return Message(m, "You cheating bastard! Pick the one you would like to view the membership off.", replyMarkup: flowObj.GetKeyboard()); } else { await AnnounceMessage(u, bot, viewMembership); u.MessageFlow = new MessageFlow(u, new FlowObject { Handler = flowObj }); await Message(u.ID, "You've been chosen to view somebody's membership. Please pick one.", replyMarkup: flowObj.GetKeyboard()).HandleReply(bot); } return Message(m, $"You have chosen {u.Bold()} to pick a player", replyMarkup: HostMessageHandler.HostKeyboard, userMarkup: true); }