Reputation: 45
I want to know the link which was used by the user to join the group and I try to get the invite_link derived from this variable :
But, when I used getUpdates() method to receive incoming updates (Update is the object on which ChatMemberUpdated is),it didn't include invite_link.
This is the code (nodejs):
await client.getUpdates({ offset : 0, allowed_updates : 'chat_member' }).then(async function(update) {
console.log(update)
if (update.length != 0){
fs.appendFile('update.txt', JSON.stringify(update), function (err) {
if (err) throw err
console.log('Saved!')
})
}
})
And this is the result:
[{"update_id":xx96xxxxx,"message":{"message_id":2xxxx,"from":{"id":x669xxxxxx,"is_bot":false,"first_name":"xx.nwxxx","language_code":"es"},"chat":{"id":-xxxx4506xxxxx,"title":"xxxxxxx","type":"supergroup"},"date":xxx195xxxx,"new_chat_participant":{"id":xxx9660xxx,"is_bot":false,"first_name":"xxxnwxxx","language_code":"es"},"new_chat_member":{"id":xxx9660xxx,"is_bot":false,"first_name":"xxxnwxxx","language_code":"es"},"new_chat_members":[{"id":xxx9660xxx,"is_bot":false,"first_name":"xxxnwxxx","language_code":"es"}]}}]
Upvotes: 0
Views: 370
Reputation: 45
At the moment to create the invite_link, you need to specified "creates_join_request" as true. Otherwise, the bot cannot detect the link.
Upvotes: 0