Answer the question
In order to leave comments, you need to log in
Eval php, why doesn't the second called function work?
Good day.
For a telegram bot, I make responses for messages that contain keywords, and delete them.
It works like this:
If you find a trigger in the message, then it calls the code template associated with the trigger -> eval(stripslashes($code));
Code example called via eval(); ->
$inter = 10; //интервал перед авто удаления сообщения отправленного ботом (сек)
$next = strval(strtotime(date("m/d/Y h:i:s a", time() + $inter)));
$msg_id = (intval($data['message']['message_id'])+1);
$msg_chat_id = $data['message']['chat']['id'];
sendTelegram(
'sendMessage',
array(
'chat_id' => $msg_chat_id,
'reply_to_message_id' => $data['message']['message_id'],
'parse_mode' => 'html',
'text' => 'текст'
)
);
call_user_func_array('autoremove_add', array($next,$msg_chat_id,$msg_id));
//autoremove_add($next,$msg_chat_id,$msg_id);
function autoremove_add($time,$chat_id,$message_id){
global $modx;
$modx->log(MODX_LOG_LEVEL_ERROR, "write_message autoremove");
$sql_1 = "INSERT INTO `crontab_telegram` (`id`, `time`, `chat_id`, `message_id`) VALUES (NULL, '$time','$chat_id','$message_id');";
$modx->exec($sql_1);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question