@@ -0,0 +1,3072 @@
+package com.stevesoltys.telegramirc.protocol.telegram.message.decoder.image;%0A%0Aimport com.stevesoltys.telegramirc.configuration.telegram.TelegramDecoderConfiguration;%0Aimport com.stevesoltys.telegramirc.protocol.telegram.bot.TelegramBot;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Component;%0Aimport org.telegram.telegrambots.TelegramApiException;%0Aimport org.telegram.telegrambots.api.methods.GetFile;%0Aimport org.telegram.telegrambots.api.objects.Message;%0Aimport org.telegram.telegrambots.api.objects.Sticker;%0A%0Aimport java.util.*;%0A%0A/**%0A * @author Steve Soltys%0A */%0A@Component%0Apublic class TelegramStickerMessageDecoder %7B%0A%0A    private static final String TELEGRAM_BOT_FILE_ENDPOINT = %22https://api.telegram.org/file/bot%22;%0A%0A    private final Logger logger = LoggerFactory.getLogger(this.getClass());%0A%0A    private final TelegramDecoderConfiguration telegramDecoderConfiguration;%0A%0A    private final ImageDecoderRepository imageDecoderRepository;%0A%0A    @Autowired%0A    public TelegramStickerMessageDecoder(TelegramDecoderConfiguration telegramDecoderConfiguration,%0A                                         ImageDecoderRepository imageDecoderRepository) %7B%0A        this.telegramDecoderConfiguration = telegramDecoderConfiguration;%0A        this.imageDecoderRepository = imageDecoderRepository;%0A    %7D%0A%0A    public List%3CString%3E decode(TelegramBot telegramBot, Message message) %7B%0A        Sticker sticker = message.getSticker();%0A        Optional%3CString%3E filePathOptional = getFilePath(telegramBot, sticker);%0A%0A        if (filePathOptional.isPresent()) %7B%0A            String telegramBotToken = telegramBot.getBotToken();%0A            String filePath = filePathOptional.get();%0A            String url = TELEGRAM_BOT_FILE_ENDPOINT + telegramBotToken + %22/%22 + filePath;%0A%0A            String imageDecoderIdentifier = telegramDecoderConfiguration.getStickerDecoder();%0A            Optional%3CImageDecoder%3E imageDecoderOptional = imageDecoderRepository.get(imageDecoderIdentifier);%0A%0A            if (imageDecoderOptional.isPresent()) %7B%0A                List%3CString%3E decodedImageResults = imageDecoderOptional.get().decode(url);%0A                List%3CString%3E results = new LinkedList%3C%3E();%0A%0A                for (String imageResult : decodedImageResults) %7B%0A                    results.add(%22(Sticker %22 + sticker.getEmoji() + %22 - %22 + imageResult + %22)%22);%0A                %7D%0A%0A                return results;%0A            %7D%0A        %7D%0A%0A        return Collections.emptyList();%0A    %7D%0A%0A    private Optional%3CString%3E getFilePath(TelegramBot telegramBot, Sticker sticker) %7B%0A        Objects.requireNonNull(sticker);%0A%0A        GetFile getFileMethod = new GetFile();%0A        getFileMethod.setFileId(sticker.getFileId());%0A%0A        try %7B%0A            return Optional.ofNullable(telegramBot.getFile(getFileMethod).getFilePath());%0A%0A        %7D catch (TelegramApiException e) %7B%0A            logger.error(%22Error while downloading Telegram sticker image: %7B%7D%22, e.toString());%0A        %7D%0A%0A        return Optional.empty();%0A    %7D%0A%0A%7D%0A

Add TelegramStickerMessageDecoder