Minor bugfix

This commit is contained in:
giuliof 2017-12-26 17:35:14 +01:00
parent b35d8831a3
commit f626fbe632
2 changed files with 144 additions and 129 deletions

View File

@ -57,6 +57,7 @@
$WELCOME_MESSAGE = "$EMOJI_BOT GOLEMbot
$EMOJI_MSG Se scrivi un messaggio ti chiedo se inoltrarlo al canale
Supporto anche **<b>grassetto</b>**, __<i>corsivo</i>__ e `<code>codice</code>`
$EMOJI_TOOLS Se scrivi un comando eseguo operazioni.
Comandi disponibili: /help, /list";
?>

View File

@ -358,7 +358,7 @@ if (isset ($row->callback_query)) {
for ($i = 8; $i <= 21; $i++) {
if ($i < $firstHour)
$kbd->insertItem(" ", null);
$kbd->insertItem(" ", "null");
else
$kbd->insertItem("$i".":00", $i);
@ -373,7 +373,6 @@ if (isset ($row->callback_query)) {
$text="A che ora vuoi inviare il messaggio?";
$reply = json_encode($container);
//~ $url = API_URL.API_TOKEN."/editMessageText?chat_id=".($chatID).
//~ "&message_id=".$inlineID .
@ -491,6 +490,22 @@ elseif (isset($row->message)) {
}
if (DEBUG) info("Starting from status $status");
// Reset CMD
if (($command = getCommand($row->message))['command'] == '/reset') {
warning("Reset command received");
$all_keys = $mc->getAllKeys();
foreach ($all_keys as $index => $key) {
if (strpos($key,$chatID) !== 0) {
$mc->delete($key);
info("Deleting $key");
}
else {
unset($all_keys[$index]);
}
}
sendMessage($chatID, "Reset completato");
}
else {
switch($status) {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* entering STATE_IDLE - message *
@ -504,13 +519,12 @@ elseif (isset($row->message)) {
case '/help':
case '/start':
// Send some explainations about this bot
sendMessage($chatID,$WELCOME_MESSAGE);
sendMessage($chatID,$WELCOME_MESSAGE, "HTML");
break;
case '/edit':
// not yet implemented
sendMessage($chatID, "Bravo! Hai trovato un comando non ancora implementato. Apri il codice su GitHub e lavoraci su",
"HTML", false, false, null, $reply);
sendMessage($chatID, "Bravo! Hai trovato un comando non ancora implementato. Apri il codice su GitHub e lavoraci su");
break;
case '/list':
@ -621,7 +635,7 @@ elseif (isset($row->message)) {
default:
wrong_action($chatID);
}
}
}
// a not supported message (i.e. from a channel)
else {