Small lines for timeout debugging

This commit is contained in:
giuliof 2017-11-21 23:54:42 +01:00
parent e0f6e5da99
commit d69033521a
4 changed files with 28 additions and 5 deletions

12
TODO
View File

@ -1,5 +1,7 @@
TODO LIST TODO LIST
============= =============
== Short term things ==
* Document code * Document code
Very important, since now it is far more complex Very important, since now it is far more complex
@ -9,9 +11,17 @@
** Create a class for inline keyboard management ** Create a class for inline keyboard management
** Use info(), warning() and error() instead of botlog() ** Use info(), warning() and error() instead of botlog()
** Always insert "or error(... $sql->error())" when making SQL queries. ** Always insert "or error(... $sql->error())" when making SQL queries.
** Use curl instead of file_get_contents() because it has a better way to
manage timeout and HTTP errors
* Capabilities to send Image/Videos/Document (at the moment are blocked) * Better way to manage Image/Videos/Document and forwarded message
* At the moment, the /list command is terrible
* (Don't know why) inline buttons have white text, but if are present
empty buttons, the following have black text
== Long term things ==
* Facebook page integration * Facebook page integration
Make the bot publish info not only in mailing list and Telegram channel, Make the bot publish info not only in mailing list and Telegram channel,
but also on our Facebook page but also on our Facebook page

View File

@ -103,10 +103,21 @@ if (isset ($row->callback_query)) {
$IDdelete = $mc->get($chatID.MC_DELETE_SCHEDULED_ID) or error("No ID to delete"); $IDdelete = $mc->get($chatID.MC_DELETE_SCHEDULED_ID) or error("No ID to delete");
$sql->query("DELETE FROM ".MYSQL_TABLE." WHERE ID=$IDdelete") $sql->query("DELETE FROM ".MYSQL_TABLE." WHERE ID=$IDdelete")
or error("Can't make the query, SQL error ".$sql->error); or error("Can't make the query, SQL error ".$sql->error);
$sql->close();
editMessageText($chatID, $inlineID, "Rimosso correttamente"); $numbers = $sql->query("SELECT COUNT(*) FROM ".MYSQL_TABLE);
die(); $numbers = $numbers->fetch_array()[0];
info("Number of pages: $numbers");
$offset = $mc->get($chatID.MC_LIST_NUMBER);
if ($numbers == 0) {
editMessageText($chatID, $inlineID, "Non ce n'è più");
$sql->close();
die();
}
elseif ($offset > 0) {
$offset--;
}
//~ die();
break; break;
case '>': case '>':
$sql = new mysqli('localhost', MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB); $sql = new mysqli('localhost', MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);

View File

@ -27,7 +27,8 @@ while ($row = $query->fetch_assoc()) {
"&parse_mode=".urlencode("Markdown"); "&parse_mode=".urlencode("Markdown");
file_get_contents($bot_query); file_get_contents($bot_query);
* */ * */
forwardMessage(API_CHANNEL_ID, $row['ChatID'], $row['MessageID']); forwardMessage(API_CHANNEL_ID, $row['ChatID'], $row['MessageID']) or
error("Scheduler couldn't forward the message. I'll try next hour");
} }

View File

@ -12,6 +12,7 @@
// Unrecoverable error, program must be terminated // Unrecoverable error, program must be terminated
function error($message) { function error($message) {
if (DEBUG) botlog("[EE] $message\n"); if (DEBUG) botlog("[EE] $message\n");
if (DEBUG) botlog('[II] BOT request (cruently) ended at ' . date('Y-m-d H:i:s') . ' ====================' . "\n");
die(); die();
} }