Open wwhiteJ opened 6 years ago
hi if you check other issues find your answer
if (link.contains("telegram.me/joinchat")){
String hash = link.split("/")[(link.split("/").length)-1];
TLRequestMessagesImportChatInvite in = new TLRequestMessagesImportChatInvite();
in.setHash(hash);
try {
TLAbsUpdates bb = kernelComm.getApi().doRpcCall(in);
} catch (Exception e) {
e.printStackTrace();
}
} else if (link.contains("telegram.me/")){
String username = link.split("/")[(link.split("/").length)-1];
try {
TLRequestContactsResolveUsername ru = new TLRequestContactsResolveUsername();
ru.setUsername(username);
TLResolvedPeer peer = kernelComm.getApi().doRpcCall(ru);
TLRequestChannelsJoinChannel join = new TLRequestChannelsJoinChannel();
TLInputChannel ch = new TLInputChannel();
ch.setChannelId(peer.getChats().get(0).getId());
ch.setAccessHash(((TLChannel) peer.getChats().get(0)).getAccessHash());
join.setChannel(ch);
kernelComm.getApi().doRpcCall(join);
} catch (Exception e) {
e.printStackTrace();
}
}
I am trying to use this api to join public groups which has short links like https://t.me/XXXXXX. Does anyone know how I can do this ?