K
K
k0smos2020-09-30 09:40:49
PHP
k0smos, 2020-09-30 09:40:49

How to distinguish a new user who has joined a group from a bot?

Hello everyone, I'm trying to get a string is_botfrom a new user, I tried a million variations, none of them worked, here is a code snippet:

if (array_key_exists("new_chat_participant", $data['message'])) {

    $mes_from = $data['message']['new_chat_participant']['is_bot'];

    if($data['message']['new_chat_participant']['id'] == $bd_user['tg_id'])
    {
        priv($hello, $data['message']['chat']['id']);
    }
    else
    {   
        if($mes_from == false) {
            kickChatMember($data['message']['chat']['id'], $data['message']['new_chat_participant']['id']);
        }
    }
}

I want to kick new users if they are not in the database, except for bots
I will be grateful for any advice

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
k0smos, 2020-09-30
@k0smos

Decided to change $mes_from == falseto$mes_from != true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question