Skip to content
Advertisement

how can i ban some numbers from checking on bot

like if someone type command “!user 123456” then send message “number banned”

I tried this but won’t worked…

$ban = array('112233','123456'); if(strpos($message, "!user $ban") ===0){ sendMessage($chatId, "<u>Number Banned!</u>", $message_id); }

Advertisement

Answer

Instead of using strpos, if you’re going to do more commands you should parse out the action and data from the message, then you can use logic to do something on user and something on foobar etc, using the rest of the message as the data or splitting it up further.

JavaScript

Then if some thing like the following is going to be used in multiple places:

JavaScript

Make a function:

JavaScript

Then use it instead of the in_array

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement