diff --git a/src/de/mrbesen/telegram/TelegramAPI.java b/src/de/mrbesen/telegram/TelegramAPI.java index aff6a60..1d46a49 100644 --- a/src/de/mrbesen/telegram/TelegramAPI.java +++ b/src/de/mrbesen/telegram/TelegramAPI.java @@ -166,7 +166,7 @@ public class TelegramAPI implements Runnable { msg_offset = (upd.update_id+1 > msg_offset ? upd.update_id+1 : msg_offset); } } - + public TUser getUser(String name) { for(TUser us : users) { if(us.getName().equals(name)) diff --git a/src/de/mrbesen/telegram/objects/TUser.java b/src/de/mrbesen/telegram/objects/TUser.java index 5eda77e..7dd95f8 100644 --- a/src/de/mrbesen/telegram/objects/TUser.java +++ b/src/de/mrbesen/telegram/objects/TUser.java @@ -105,25 +105,35 @@ public class TUser { } public void sendImage(String caption, String url) { + sendImage(api, id, caption, url); + } + + public static void sendImage(TelegramAPI api, int userid, String caption, String url) { try { String cap = ""; if(caption != null) { if(!caption.isEmpty()) cap = "&caption=" + caption; } - api.request("sendPhoto", "chat_id=" + id + cap + "&photo=" + url); + api.request("sendPhoto", "chat_id=" + userid + cap + "&photo=" + url); } catch (IOException e) { e.printStackTrace(); } } + + public void sendAnimation(String caption, String url) { + sendAnimation(api, id, caption, url); + } + + public static void sendAnimation(TelegramAPI api, int userid, String caption, String url) { try { String cap = ""; if(caption != null) { if(!caption.isEmpty()) cap = "&caption=" + caption; } - api.request("sendAnimation", "chat_id=" + id + cap + "&animation=" + url); + api.request("sendAnimation", "chat_id=" + userid + cap + "&animation=" + url); } catch (IOException e) { e.printStackTrace(); }