changed userid to long

This commit is contained in:
MrBesen 2019-04-13 01:58:28 +02:00
parent c5ef10ba80
commit dcc774c4d3
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
4 changed files with 20 additions and 20 deletions

View File

@ -14,7 +14,7 @@ public class MessageBuilder {
private Formatting format = Formatting.None;
private boolean silent = false;
private boolean no_web_view = false;
private int reciver_id = 0;
private long reciver_id = 0;
private int reply_to_message_id = 0;
private TReplyMarkup markup = null;
private boolean async = false;
@ -26,7 +26,7 @@ public class MessageBuilder {
private String caption = null;
private int updates = 0;
public MessageBuilder setReciver(int id) {
public MessageBuilder setReciver(long id) {
reciver_id = id;
return this;
}

View File

@ -195,7 +195,7 @@ public class TelegramAPI implements Runnable {
* @param async
* @param clb
*/
public void updateCaption(final String newCaption, int chatid, int msg_id, TReplyMarkup rm, boolean async, Callback<JSONObject, ?> clb) {
public void updateCaption(final String newCaption, long chatid, int msg_id, TReplyMarkup rm, boolean async, Callback<JSONObject, ?> clb) {
try {
String rply = "";
if(rm != null)
@ -211,7 +211,7 @@ public class TelegramAPI implements Runnable {
}
}
public void updateMarkup(int chatid, int msg_id, TReplyMarkup rm, boolean async) {
public void updateMarkup(long chatid, int msg_id, TReplyMarkup rm, boolean async) {
try {
if(rm == null) return;//nope

View File

@ -14,7 +14,7 @@ public class TMessage extends JSONBased {
private long date = -1;
private TUser forward_from = null; //optional
private String text = null;//optional
private int chatid = 0;
private long chatid = 0;
protected TelegramAPI api;
@ -43,7 +43,7 @@ public class TMessage extends JSONBased {
public TMessage forward(TUser us) {
return forward(api, us.getID(), this);
}
public static TMessage forward(TelegramAPI api, int userid, TMessage tmsg) {
public static TMessage forward(TelegramAPI api, long userid, TMessage tmsg) {
try {
String fro = String.valueOf(tmsg.forward_from == null ? tmsg.from.getID() : tmsg.forward_from.getID());
return new TMessage(api.request("forwardMessage", "chat_id=" + userid + "&from_chat_id=" + fro + "&message_id=" + tmsg.message_id).getJSONObject("result"), api);
@ -53,7 +53,7 @@ public class TMessage extends JSONBased {
return null;
}
public static void forwardAsync(TelegramAPI api, int userid, TMessage tmsg) {
public static void forwardAsync(TelegramAPI api, long userid, TMessage tmsg) {
String fro = String.valueOf(tmsg.forward_from == null ? tmsg.from.getID() : tmsg.forward_from.getID());
api.request(new Task("forwardMessage", "chat_id=" + userid + "&from_chat_id=" + fro + "&message_id=" + tmsg.message_id));
}
@ -63,7 +63,7 @@ public class TMessage extends JSONBased {
this.api = api;
message_id = json.getInt("message_id");
date = json.getLong("date");
chatid = ((JSONObject) get(Member.chat)).getInt("id");
chatid = ((JSONObject) get(Member.chat)).getLong("id");
if(json.has("from"))
from = api.getUser(json.getJSONObject("from"));
@ -76,7 +76,7 @@ public class TMessage extends JSONBased {
allowedmembers = new Member[] {Member.forward_from_message_id, Member.forward_signature, Member.forward_date, Member.reply_to_message, Member.edit_date, Member.media_group_id, Member.author_signature, Member.author_signature, Member.audio, Member.document, Member.game, Member.photo, Member.sticker, Member.video, Member.voice, Member.video_note, Member.caption, Member.contact, Member.location, Member.venue, Member.new_chat_members, Member.left_chat_members, Member.new_chat_title, Member.new_chat_photo, Member.delete_chat_photo, Member.group_chat_created, Member.supergroup_chat_created, Member.channel_chat_created, Member.migrate_from_chat_id, Member.migrate_to_chat_id, Member.pinned_message, Member.invoice, Member.successful_payment, Member.connected_website, Member.chat};
}
public int getChatID() {
public long getChatID() {
return chatid;
}
@ -100,11 +100,11 @@ public class TMessage extends JSONBased {
return message_id;
}
public static void delete(TelegramAPI api, int chatid, int msgid) {
public static void delete(TelegramAPI api, long chatid, int msgid) {
delete(api, chatid, msgid, false);
}
public static void delete(TelegramAPI api, int chatid, int msgid, boolean async) {
public static void delete(TelegramAPI api, long chatid, int msgid, boolean async) {
String q = "chat_id=" + chatid + "&message_id=" + msgid;
if(async) {
api.requestAsync("deleteMessage", q);

View File

@ -9,7 +9,7 @@ import de.mrbesen.telegram.TelegramAPI;
public class TUser {
private int id;
private long id;
private String uname;//optional
private String firstname;
@ -19,13 +19,13 @@ public class TUser {
private TelegramAPI api = null;
TUser(int chatid, String uname, TelegramAPI api) {
TUser(long chatid, String uname, TelegramAPI api) {
this.id = chatid;
this.uname = uname;
this.api = api;
}
public TUser(int chatid, TelegramAPI api) {
public TUser(long chatid, TelegramAPI api) {
this.api = api;
this.id = chatid;
}
@ -34,7 +34,7 @@ public class TUser {
this.api = api;
firstname = o.getString("first_name");
isBot = o.getBoolean("is_bot");
id = o.getInt("id");
id = o.getLong("id");
if(o.has("last_name"))
lastname = o.getString("last_name");
if(o.has("username"))
@ -59,7 +59,7 @@ public class TUser {
return isBot;
}
public int getID() {
public long getID() {
return id;
}
@ -88,7 +88,7 @@ public class TUser {
* @param reply_to_msg 0 = no reply
* @return
*/
public static boolean sendMessage(TelegramAPI api, int userid, String text, TReplyMarkup rm, int reply_to_msg, boolean async, Callback<TMessage, ?> callb) {
public static boolean sendMessage(TelegramAPI api, long userid, String text, TReplyMarkup rm, int reply_to_msg, boolean async, Callback<TMessage, ?> callb) {
if(api == null) {
System.err.println("api == null!");
return false;
@ -107,10 +107,10 @@ public class TUser {
}
public boolean sendImage(String caption, String url) {
return sendImage(api, id, caption, url, null, null) != null;
return sendImage(api, id, caption, url, null, null) != null;
}
public static TMessage sendImage(TelegramAPI api, int userid, String caption, String url, TReplyMarkup rply, Callback<TMessage, ?> async) {
public static TMessage sendImage(TelegramAPI api, long userid, String caption, String url, TReplyMarkup rply, Callback<TMessage, ?> async) {
MessageBuilder msgb = new MessageBuilder().setReciver(userid).setCaption(caption).setAttachment(Attachment.Photo, url).setMarkup(rply).setCallback(async).setAsync(async != null);
return api.sendMessage(msgb.build());
}
@ -119,7 +119,7 @@ public class TUser {
return sendAnimation(api, id, caption, url, null, null) != null;
}
public static TMessage sendAnimation(TelegramAPI api, int userid, String caption, String url, TReplyMarkup rply, Callback<TMessage, ?> async) {
public static TMessage sendAnimation(TelegramAPI api, long userid, String caption, String url, TReplyMarkup rply, Callback<TMessage, ?> async) {
MessageBuilder msgb = new MessageBuilder().setReciver(userid).setCaption(caption).setAttachment(Attachment.Animation, url).setMarkup(rply).setCallback(async).setAsync(async != null);
return api.sendMessage(msgb.build());
}