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

com.antonioaltieri.telegram.botapi.requests.SendMessageRequest Maven / Gradle / Ivy

There is a newer version: 1.3.7
Show newest version
package com.antonioaltieri.telegram.botapi.requests;

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

import java.util.HashMap;
import java.util.Map;

public final class SendMessageRequest implements ApiRequest {

    private Map args = new HashMap<>();

    public SendMessageRequest(int chatId, String text) {
        this(chatId, text, null);
    }

    public SendMessageRequest(int chatId, String text, OptionalArgs optionalArgs) {
        args.put("chat_id", String.valueOf(chatId));
        args.put("text", text);

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

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

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

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

    @Override
    public RequestStrategy getRequestStrategy() {
        return new PostStrategy();
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy