/// <summary> /// Initializes arrays (keyboards are unique always) /// </summary> private void Init() { m_ReplyMarkupKeyboard.ResizeKeyboard = true; m_ReplyMarkupKeyboard.Keyboard = new KeyboardButton[][] { new KeyboardButton[] { new KeyboardButton("Start 2048") }, new KeyboardButton[] { new KeyboardButton("About Us") } }; m_GameKeyboardMarkup.InlineKeyboard = new InlineKeyboardButton[][] { new InlineKeyboardButton[] { InlineKeyboardButton.WithCallBackGame("Start Game", new CallbackGame()) } }; m_AboutKeyboardMarkup.InlineKeyboard = new InlineKeyboardButton[][] { new InlineKeyboardButton[] { InlineKeyboardButton.WithUrl("Telegram Channel", "https://t.me/your_channel"), InlineKeyboardButton.WithUrl("Instagram", "https://www.instagram.com/your_instagram/"), InlineKeyboardButton.WithUrl("About Us", "http://your_domain_name.x/x/") } }; }
public async Task Should_Send_Game_With_ReplyMarkup() { Message gameMessage = await BotClient.SendGameAsync( /* chatId: */ _fixture.SupergroupChat.Id, /* gameShortName: */ _classFixture.GameShortName, replyMarkup : new[] { InlineKeyboardButton.WithCallBackGame(/* text: */ "Play"), InlineKeyboardButton.WithCallbackData(/* textAndCallbackData: */ "Second button") } ); Assert.Equal(MessageType.Game, gameMessage.Type); Assert.NotEmpty(gameMessage.Game.Title); Assert.NotEmpty(gameMessage.Game.Description); Assert.NotNull(gameMessage.Game.Photo); Assert.NotEmpty(gameMessage.Game.Photo.Select(p => p.FileId)); Assert.All(gameMessage.Game.Photo, p => Assert.True(p.FileSize > 1_000)); Assert.All(gameMessage.Game.Photo, p => Assert.True(p.Width > 80)); Assert.All(gameMessage.Game.Photo, p => Assert.True(p.Height > 40)); }
public async Task Should_Send_Game_With_ReplyMarkup() { await _fixture.SendTestCaseNotificationAsync(FactTitles.ShouldSendGameWithReplyMarkup); Message gameMessage = await BotClient.SendGameAsync( chatId : _fixture.SupergroupChat.Id, gameShortName : _classFixture.GameShortName, replyMarkup : new[] { InlineKeyboardButton.WithCallBackGame("Play"), InlineKeyboardButton.WithCallbackData("Second button") } ); Assert.Equal(MessageType.Game, gameMessage.Type); Assert.NotEmpty(gameMessage.Game.Title); Assert.NotEmpty(gameMessage.Game.Description); Assert.NotNull(gameMessage.Game.Photo); Assert.NotEmpty(gameMessage.Game.Photo.Select(_ => _.FileId)); Assert.All(gameMessage.Game.Photo, _ => Assert.True(_.FileSize > 50)); Assert.All(gameMessage.Game.Photo, _ => Assert.True(_.Width > 25)); Assert.All(gameMessage.Game.Photo, _ => Assert.True(_.Height > 25)); }