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

com.mocean.modules.command.mc.TgRequestContact 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 TgRequestContact extends AbstractMc{

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

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

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

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

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

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

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

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


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

    public TgRequestContact button (String text) {
        HashMap tgKeyboard = new HashMap();
        tgKeyboard.put("button_text",text);
        tgKeyboard.put("button_request","contact");
        this.requestData.put("tg_keyboard",tgKeyboard);
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy