Answer the question
In order to leave comments, you need to log in
How to get the user ID of a user who joined a private group by an invite link created by a bot?
Good evening everyone.
Faced a small problem. Diligent combing through the Internet did not help much.
I'm trying to make the bot send a message to a person who has joined a private channel via an invite link created by this bot, immediately after he has joined the channel.
The block for sending a message by the bot to the user is removed if the user sent an application for joining via the link created by the bot.
Now the question remains: how to get the user ID and immediately after the entry send him a message?
The search led to the
@dp.chat_join_request_handler() handler
AND a postscript like:
async def join(update: types.ChatJoinRequest):
await update.approve()
Logically, this code should automatically accept all applications for membership, but for some reason this does not work.
If someone can help me figure it out, I'd appreciate it!
Answer the question
In order to leave comments, you need to log in
Since you did not deign to indicate the library used, I will give an example from the first one that I remembered.
@bot.message_handler(content_types=['new_chat_members'])
def new_chat_members(message):
bot.send_message(message.from_user.id, "какая-то чертовски важная инфа")
The block for sending a message by the bot to the user is removed...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question