pythontelegramtelethonpy-telegram-bot-apireply

Send direct message to new members from target telegram group


i want to make a script, that get the user_id from new joined members in a target group, and send to new member a direct message, how i can do that?

I didn't know what to try.


Solution

  • I think its a welcome message from new member. You can try this code. Correct me if i wrong.

    @bot.on(events.ChatAction)
    async def handler(event):
    
    if event.user_joined:
        await event.reply('Your Custom Message')
        print(event.sender.id)
    

    With this code, will send a new message when nember joined to your group and print their user_id to your terminal.