public void Execute() { Response <IList <RssEntity> > rssRemove = _queryRssService.GetList(_callbackQueryEventArgs.CallbackQuery.From.Id); InlineKeyboardButton[][] keyboardButtonsListrssRemove = new InlineKeyboardButton[rssRemove.ResponseData.Count + 1][]; keyboardButtonsListrssRemove = new InlineKeyboardButton[rssRemove.ResponseData.Count + 1][]; for (int i = 0; i < rssRemove.ResponseData.Count; i++) { int count = _queryRssChatRelationService.GetList(_callbackQueryEventArgs.CallbackQuery.From.Id, rssRemove.ResponseData[i].AliasName, CDO.Enums.Chat.ListChatRelation.ByAliasName).ResponseData.Count; if (count.Equals(0)) { keyboardButtonsListrssRemove[i] = new InlineKeyboardButton[] { InlineKeyboardButton.WithCallbackData(rssRemove.ResponseData[i].AliasName, string.Concat("RemoveRss_", rssRemove.ResponseData[i].Id)) } } ; } keyboardButtonsListrssRemove[rssRemove.ResponseData.Count] = new InlineKeyboardButton[] { InlineKeyboardButton.WithCallbackData("Back to Home") }; _telegramBotClient.EditMessageTextAsync( _callbackQueryEventArgs.CallbackQuery.From.Id, _callbackQueryEventArgs.CallbackQuery.Message.MessageId, "you can only remove rss that is not attached to any group or channel. listed below that is not attached to any group or channel.", replyMarkup: new InlineKeyboardMarkup(keyboardButtonsListrssRemove.Where(x => x != null).ToArray())).GetAwaiter(); } }
public void Execute() { Response <IList <ChannelEntity> > channelsRemove = _queryChannelService.GetList(_callbackQueryEventArgs.CallbackQuery.From.Id, CDO.Enums.Chat.ChatType.Group); InlineKeyboardButton[][] keyboardButtonsListChannelsRemove = new InlineKeyboardButton[channelsRemove.ResponseData.Count + 1][]; keyboardButtonsListChannelsRemove = new InlineKeyboardButton[channelsRemove.ResponseData.Count + 1][]; for (int i = 0; i < channelsRemove.ResponseData.Count; i++) { int count = _queryRssChatRelationService.GetList(_callbackQueryEventArgs.CallbackQuery.From.Id, channelsRemove.ResponseData[i].Name, CDO.Enums.Chat.ListChatRelation.ByChatName).ResponseData.Count; if (count.Equals(0)) { keyboardButtonsListChannelsRemove[i] = new InlineKeyboardButton[] { InlineKeyboardButton.WithCallbackData(channelsRemove.ResponseData[i].Name, string.Concat("RemoveGroup_", channelsRemove.ResponseData[i].Name)) } } ; } keyboardButtonsListChannelsRemove[channelsRemove.ResponseData.Count] = new InlineKeyboardButton[] { InlineKeyboardButton.WithCallbackData("Back to Home") }; _telegramBotClient.EditMessageTextAsync( _callbackQueryEventArgs.CallbackQuery.From.Id, _callbackQueryEventArgs.CallbackQuery.Message.MessageId, "to remove channel, choose one.", replyMarkup: new InlineKeyboardMarkup(keyboardButtonsListChannelsRemove.Where(x => x != null).ToArray())).GetAwaiter(); } }