disable web preview in feedbackinfo; added allow_sending_without_reply in messagebuilder
This commit is contained in:
parent
7d1e478260
commit
6ca91303b3
|
@ -14,6 +14,7 @@ public class MessageBuilder {
|
||||||
private Formatting format = Formatting.None;
|
private Formatting format = Formatting.None;
|
||||||
private boolean silent = false;
|
private boolean silent = false;
|
||||||
private boolean no_web_view = false;
|
private boolean no_web_view = false;
|
||||||
|
private boolean allow_sending_without_reply = false;
|
||||||
private long reciver_id = 0;
|
private long reciver_id = 0;
|
||||||
private int reply_to_message_id = 0;
|
private int reply_to_message_id = 0;
|
||||||
private TReplyMarkup markup = null;
|
private TReplyMarkup markup = null;
|
||||||
|
@ -149,6 +150,16 @@ public class MessageBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* should fail when a message, thats replyed to is not existent default is true
|
||||||
|
* @param b
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public MessageBuilder setFailwithoutReply(boolean b) {
|
||||||
|
allow_sending_without_reply = !b;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public SendableMessage build() {
|
public SendableMessage build() {
|
||||||
if(reciver_id == 0) {
|
if(reciver_id == 0) {
|
||||||
throw new MissingException("Reciver");
|
throw new MissingException("Reciver");
|
||||||
|
@ -191,10 +202,13 @@ public class MessageBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(no_web_view) {
|
if(no_web_view) {
|
||||||
optionals += "&disable_web_page_preview=" + no_web_view;
|
optionals += "&disable_web_page_preview=true";
|
||||||
}
|
}
|
||||||
if(silent) {
|
if(silent) {
|
||||||
optionals += "&disable_notification=" + silent;
|
optionals += "&disable_notification=true";
|
||||||
|
}
|
||||||
|
if(allow_sending_without_reply) {
|
||||||
|
optionals += "&allow_sending_without_reply=true";
|
||||||
}
|
}
|
||||||
|
|
||||||
String q = "chat_id=" + reciver_id + text + optionals + attachment;
|
String q = "chat_id=" + reciver_id + text + optionals + attachment;
|
||||||
|
|
|
@ -103,9 +103,12 @@ public class FeedbackCommand implements JSONCommandHandler {
|
||||||
protected MessageBuilder createInfo(TUser u, int msgid, boolean firstmsg) {
|
protected MessageBuilder createInfo(TUser u, int msgid, boolean firstmsg) {
|
||||||
String info = "Feedbackinfo:\n" + "userid: " + u.getID() + "\nusername: " + u.getName() + "\nfullname: " + u.getFirstName() + ' ' + u.getLastName();
|
String info = "Feedbackinfo:\n" + "userid: " + u.getID() + "\nusername: " + u.getName() + "\nfullname: " + u.getFirstName() + ' ' + u.getLastName();
|
||||||
|
|
||||||
|
MessageBuilder mb = new MessageBuilder().setAsync();
|
||||||
|
|
||||||
if(firstmsg && feedbackCallback != null) {
|
if(firstmsg && feedbackCallback != null) {
|
||||||
try {
|
try {
|
||||||
info += '\n' + feedbackCallback.apply(u);
|
info += '\n' + feedbackCallback.apply(u);
|
||||||
|
mb.setNoWebView(true);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
info += "\nError getting information: " + t.getMessage();
|
info += "\nError getting information: " + t.getMessage();
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
@ -115,7 +118,7 @@ public class FeedbackCommand implements JSONCommandHandler {
|
||||||
TInlineKeyboardMarkup markup = new TInlineKeyboardMarkup(1);
|
TInlineKeyboardMarkup markup = new TInlineKeyboardMarkup(1);
|
||||||
markup.addUrlButton("chat with user", "https://t.me/" + u.getName(), 1);
|
markup.addUrlButton("chat with user", "https://t.me/" + u.getName(), 1);
|
||||||
markup.addCallbackButton("↩ reply", buildRplyCallback(u.getID(), msgid), 1);
|
markup.addCallbackButton("↩ reply", buildRplyCallback(u.getID(), msgid), 1);
|
||||||
return new MessageBuilder().setAsync().setText(info).setFormatting(MessageBuilder.Formatting.HTML).setMarkup(markup);
|
return mb.setText(info).setFormatting(MessageBuilder.Formatting.HTML).setMarkup(markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCallback(UserCallbackEvent e) {
|
public boolean onCallback(UserCallbackEvent e) {
|
||||||
|
|
Loading…
Reference in New Issue