wrote a bot that should block absolutely all new members of the chat (excluding those usernames in the database)
Here is my code:
$data = json_decode(file_get_contents('php://input')); if (isset($data->{'message'}->{'chat'}->{'type'}) && $data->{'message'}->{'chat'}->{'type'} == 'supergroup') { $id_user = $data->{'message'}->{'new_chat_members'}->{'id'}; $id_chat = $data->{'message'}->{'chat'}->{'id'}; $username_chat = $data->{'message'}->{'chat'}->{'username'}; $username_user = $data->{'message'}->{'new_chat_members'}->{'username'}; $query_count = mysqli_query($connect, "SELECT * FROM `telegram` WHERE `chat_username` = '".$username_chat."' AND `username` = '".$username_user."'"); $query_count = mysqli_num_rows($query_count); if (!($query_count)) file_get_contents("https://api.telegram.org/botHASH/restrictChatMember?chat_id=".$id_chat."&user_id=".$id_user); } The problem is that it does not work clearly, those who are in the database are not clearly banned, but ordinary users will be banned once or later.
What is the problem?
Thank you in advance!