Answer the question
In order to leave comments, you need to log in
How to remove the text mentioning the bot from the Vkontakte message?
There is a bot in php. When mentioned in a conversation, the text of the message is taken and sent upside down. The mention text is also taken, but I don't need it. Tell me how to fix it, or just remove the first characters through a crutch?
Main parts of the code:
$id = $data->object->from_id;
$peer_id = $data->object->peer_id;
$message = $data->object->text;
if ($data->type == 'message_new') {
$vk->sendMessage($peer_id, $message));
}
Answer the question
In order to leave comments, you need to log in
There is little information about what the bot message looks like.
If everything is in the @ symbol (dog), then simply:
$id = $data->object->from_id;
$peer_id = $data->object->peer_id;
$message = $data->object->text;
$peer_id = str_replace("what are we looking for",what are we changing to",$peer_id );
if ($data->type == 'message_new') {
$vk->sendMessage($peer_id, $message));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question