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

            await _telegramBotClient.EditMessageTextAsync(
                chatId : chatId,
                messageId : messageId,
                text : pageModel.MessageText,
                parseMode : ParseMode.Markdown,
                replyMarkup : pageModel.Keyboard);
        }
Beispiel #2
0
        public async Task ExecuteCommandAsync(Message message)
        {
            var droplets = await _digitalOceanClient.Droplets.GetAll();

            if (droplets.Count > 0)
            {
                _storageService.AddOrUpdate(StorageKeys.Droplets, droplets);
                var pageModel = _dropletPaginatorService.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 : DropletMessage.GetDropletsNotFoundMessage());
            }
        }