This snippet will get the most recent conversation and send a sticker in thie conversation.
Still a lot of abstraction/classes because of the tl-schema :(

// This is a synchronous client, that will block until the response arrive (or until timeout)
TelegramClient client = Kotlogram.getDefaultClient(application, new ApiStorage());

// You can start making requests
try {
    TLAbsDialogs tlAbsDialogs = client.messagesGetDialogs(0, 0, new TLInputPeerEmpty(), 1);
    TLAbsInputPeer inputPeer = getInputPeer(tlAbsDialogs);

    // Get the stickers available for emoji sunglass
    TLStickers tlStickers = (TLStickers) client.messagesGetStickers("\uD83D\uDE0E", "");
    if (!tlStickers.getStickers().isEmpty()) {
        // Take first available one
        TLDocument tlDocument = tlStickers.getStickers().get(0).getAsDocument();
        TLInputDocument tlInputDocument = new TLInputDocument(tlDocument.getId(), tlDocument.getAccessHash());

        TLAbsUpdates tlAbsUpdates = client.messagesSendMedia(false, false, false,
                                                             inputPeer, null, new TLInputMediaDocument(tlInputDocument, ""),
                                                             Math.abs(new Random().nextLong()), null);
        // tlAbsUpdates contains the id and date of the message in a TLUpdateShortSentMessage
    } else {
        System.err.println("No sticker found");
} catch (RpcErrorException | IOException e) {
} finally {
    client.close(); // Important, do not forget this, or your process won't finish


By calling messagesGetStickers we get the list of stickers installed that are represented by the emoji :sunglasses: (\uD83D\uDE0E).
The second parameter hash is string that indicates the currently known stickers. I don't have any supplementary information about this, if you want more details, study the official clients and let me know if you find something :)
Passing an empty string ensures that we'll get all the available stickers.

Did this page help you?