rubenlagus / TelegramApi

Java library to create Telegram Clients
MIT License
300 stars 108 forks source link

how to get and/or revoke a supergroup invite link #18

Open A7F opened 7 years ago

A7F commented 7 years ago

I have the following code:

[previous lines...]

TLRequestMessagesExportChatInvite in = new TLRequestMessagesExportChatInvite();
in.setChatId(message.getChatId());
 try {
       TLChatInviteExported ex = kernelComm.getApi().doRpcCall(in); 
} catch (TimeoutException | IOException ex) {
       Logger.getLogger(InGroups.class.getName()).log(Level.SEVERE, null, ex);
}

where message is the incoming TLMessage object. The problem is, when the program flow comes to the rpc call within a supergroup, it says CHAT_ID_INVALID but the chat id exists, I checked it. I am the owner of that supergroup, so are there any different ways to retrieve the group link? I tried to use this remote call within a chat (non-supergroup nor channel) but nothing happens and outputs no errors at all so maybe there are other ways to get the supergroup link (without making it public).

Also, how do I revoke a link? I can't find any remote procedure call method about that

EDIT: i found TLRequestChannelsExportInvite but, when I perform the rpcCall, which object should I expect to use in order to get the link?