sending images only with userid
This commit is contained in:
parent
2f4309042e
commit
5147b40fdc
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue