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

com.mocean.modules.command.mc.TgSendText Maven / Gradle / Ivy

Go to download

This is an Mocean SDK written in java. To use it you will need a mocean account. Signup for free at https://moceanapi.com

There is a newer version: 1.1.5
Show newest version
package com.mocean.modules.command.mc;

import java.util.ArrayList;
import java.util.HashMap;

public class TgSendText extends AbstractMc{

    public TgSendText() {
        this(new HashMap<>());
    }

    public TgSendText(HashMap params) {
        super(params);
    }

    @Override
    protected ArrayList requiredKey() {
        return new ArrayList(){{
            add("from");
            add("to");
            add("content");
        }};
    }

    @Override
    protected String action() {
        return "send-telegram";
    }

    public TgSendText from (String id) {
        return this.from(id,"bot_username");
    }

    public TgSendText from (String id, String type) {
        this.removeParams("from");
        HashMap params = new HashMap();
        params.put("id",id);
        params.put("type",type);
        this.requestData.put("from",params);
        return this;
    }

    public TgSendText to (String id) {
        return this.to(id,"chat_id");
    }

    public TgSendText to (String id, String type) {
        this.removeParams("to");
        HashMap params = new HashMap();
        params.put("id",id);
        params.put("type",type);
        this.requestData.put("to",params);
        return this;
    }

    public TgSendText content (String text) {
        this.removeParams("content");
        HashMap params = new HashMap();
        params.put("text",text);
        params.put("type","text");
        this.requestData.put("content",params);
        return this;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy