Example #1
0
        public async Task ExecuteCallbackQueryAsync(long chatId, int messageId, string callbackQueryId, string payload)
        {
            var pageCount = int.Parse(payload);
            var pageModel = _projectPaginatorService.GetPage(pageCount);

            await _telegramBotClient.EditMessageTextAsync(
                chatId : chatId,
                messageId : messageId,
                text : pageModel.MessageText,
                parseMode : ParseMode.Markdown,
                replyMarkup : pageModel.Keyboard);
        }
        public async Task ExecuteCommandAsync(Message message)
        {
            var projects = await _digitalOceanClient.Projects.GetAll();

            if (projects.Count > 0)
            {
                _storageService.AddOrUpdate(StorageKeys.Projects, projects);
                var pageModel = _projectPaginatorService.GetPage(0);

                await _telegramBotClient.SendTextMessageAsync(
                    chatId : message.Chat.Id,
                    text : pageModel.MessageText,
                    parseMode : ParseMode.Markdown,
                    replyMarkup : pageModel.Keyboard);
            }
            else
            {
                await _telegramBotClient.SendTextMessageAsync(
                    chatId : message.Chat.Id,
                    text : ProjectMessage.GetProjectsNotFoundMessage());
            }
        }