Browse Source

Small lines for timeout debugging

master
giuliof 5 years ago
parent
commit
d69033521a
  1. 12
      TODO
  2. 17
      main.php
  3. 3
      schedule.php
  4. 1
      shared.php

12
TODO

@ -1,5 +1,7 @@
TODO LIST
=============
== Short term things ==
* Document code
Very important, since now it is far more complex
@ -9,9 +11,17 @@
** Create a class for inline keyboard management
** Use info(), warning() and error() instead of botlog()
** 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
* Better way to manage Image/Videos/Document and forwarded message
* At the moment, the /list command is terrible
* Capabilities to send Image/Videos/Document (at the moment are blocked)
* (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
Make the bot publish info not only in mailing list and Telegram channel,
but also on our Facebook page

17
main.php

@ -103,10 +103,21 @@ if (isset ($row->callback_query)) {
$IDdelete = $mc->get($chatID.MC_DELETE_SCHEDULED_ID) or error("No ID to delete");
$sql->query("DELETE FROM ".MYSQL_TABLE." WHERE ID=$IDdelete")
or error("Can't make the query, SQL error ".$sql->error);
$sql->close();
editMessageText($chatID, $inlineID, "Rimosso correttamente");
die();
$numbers = $sql->query("SELECT COUNT(*) FROM ".MYSQL_TABLE);
$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;
case '>':
$sql = new mysqli('localhost', MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);

3
schedule.php

@ -27,7 +27,8 @@ while ($row = $query->fetch_assoc()) {
"&parse_mode=".urlencode("Markdown");
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");
}

1
shared.php

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

Loading…
Cancel
Save