Пример #1
0
        public async Task <BotResponseCode> TryHandleInlineQuery(UpdateDto updateDto)
        {
            // If the bot can't do anything with the update's inline query, we're done.
            if (!CanHandleInlineQuery(updateDto))
            {
                // If there is an id, let telegram know the inline query has been handled.
                if (!string.IsNullOrEmpty(updateDto.ParsedUpdateId))
                {
                    await _sendMessageService.AnswerInlineQuery(updateDto.ParsedUpdateId, new List <InlineQueryResultArticle>());
                }

                return(BotResponseCode.NoAction);
            }

            // Check if any command should be handled and if so handle it.
            var commandResponseCode = await _inlineQueryCommandsService.TryHandleCommand(updateDto);

            if (commandResponseCode != BotResponseCode.NoAction)
            {
                return(commandResponseCode);
            }

            // This should never happen.
            throw new InlineQueryNotHandledException();
        }