All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Explore the source code of the class SendStickerRequest.java

package com.antonioaltieri.telegram.botapi.requests;

import com.antonioaltieri.telegram.botapi.types.Message;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class SendStickerRequest implements ApiRequest {

    private Map args = new HashMap<>();
    private RequestStrategy requestStrategy;

    public SendStickerRequest(long chatId, File sticker) {
        this(chatId, sticker, null);
    }

    public SendStickerRequest(long chatId, File sticker, com.antonioaltieri.telegram.botapi.requests.OptionalArgs optionalArgs) {
        args.put("chat_id", String.valueOf(chatId));

        if (optionalArgs != null)
            args.putAll(optionalArgs.options());

        requestStrategy = new MultipartStrategy(sticker, "sticker");
    }

    public SendStickerRequest(long chatId, String sticker) {
        this(chatId, sticker, null);
    }

    public SendStickerRequest(long chatId, String sticker, OptionalArgs optionalArgs) {
        args.put("chat_id", String.valueOf(chatId));
        args.put("sticker", sticker);

        if (optionalArgs != null)
            args.putAll(optionalArgs.options());

        requestStrategy = new PostStrategy();
    }


    @Override
    public String getMethodName() {
        return "sendSticker";
    }

    @Override
    public ResultTypes getResultType() {
        return ResultTypes.MESSAGE;
    }

    @Override
    public Map getArgs() {
        return args;
    }

    @Override
    public RequestStrategy getRequestStrategy() {
        return requestStrategy;
    }

    @Override
    public String toString() {
        return "SendStickerRequest{" +
                "args=" + args +
                ", requestStrategy=" + requestStrategy +
                '}';
    }
}