Skip to content

Commit

Permalink
Split command_string
Browse files Browse the repository at this point in the history
  • Loading branch information
SmugZombie committed Feb 5, 2020
1 parent ea624aa commit cca8c3e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
$message_body = $data['text'];
$bot_name = explode("<at>",explode("</at>", $message_body)[0])[1];
$bot_regex = '/<at>.*<\/at>\s?/m';
$command = strtolower(str_replace('nbsp', '', preg_replace("/[^A-Za-z0-9 ]/", '', preg_replace($bot_regex, "", $message_body))));
$command_string = strtolower(str_replace('nbsp', '', preg_replace("/[^A-Za-z0-9 ]/", '', preg_replace($bot_regex, "", $message_body))));
$command_string_parts = explode(" ", $command_string);

if(isset($command_string_parts[0])){
$command = $command_string_parts[0];
}

// DEBUG
error_log(json_encode($data));
Expand Down

0 comments on commit cca8c3e

Please sign in to comment.