Skip to content

Commit

Permalink
Fixed cleanup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjasoturi committed Feb 20, 2024
1 parent 2a842aa commit f8e7814
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/bot/cleanup_collect.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@
// Get chat_id and message_id
$chat_id = $message['chat']['id'];
$message_id = $message['message_id'];
$thread_id = $message['message_thread_id'] ?? NULL;
if(isset($message['reply_markup']['inline_keyboard'])) {
$split_data = explode(':', $message['reply_markup']['inline_keyboard'][0][0]['callback_data']);
$cleanup_id = $split_data[0];
}else {
// Get id from text.
$cleanup_id = substr($message['text'],strpos($message['text'], substr(strtoupper($config->BOT_ID), 0, 1) . '-ID = ') + 7);
$idFromText = substr($message['text'],strpos($message['text'], substr(strtoupper($config->BOT_ID), 0, 1) . '-ID = ') + 7);
if(preg_match("^[0-9]+^", $idFromText)) {
$cleanup_id = $idFromText;
}
}

// Write cleanup info to database.
cleanup_log('Calling cleanup preparation now!');
cleanup_log('Cleanup_ID: ' . $cleanup_id);
if($cleanup_id != 0) {
require_once(LOGIC_PATH . '/insert_cleanup.php');
insert_cleanup($chat_id, $message_id, $cleanup_id, 'inline_poll_text');
insert_cleanup($chat_id, $message_id, $thread_id, $cleanup_id, 'inline_poll_text');
}
}

0 comments on commit f8e7814

Please sign in to comment.