com.mocean.modules.command.mc.TgRequestContact Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of moceanapisdk Show documentation
Show all versions of moceanapisdk Show documentation
This is an Mocean SDK written in java. To use it you will need a mocean account. Signup for free at https://moceanapi.com
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