|
|
|
@ -31,6 +31,7 @@ $mc->addServer('localhost', MEMCACHED_PORT)
|
|
|
|
|
* **Generic message**
|
|
|
|
|
* $row
|
|
|
|
|
* |_ message § Message
|
|
|
|
|
* |_ message_id § integer
|
|
|
|
|
* |_ chat § chat
|
|
|
|
|
* |_ id (chatID) § integer
|
|
|
|
|
* |_ username (if set - user name for private chat, else channel or group name) § string
|
|
|
|
@ -233,6 +234,11 @@ if (isset ($row->callback_query)) {
|
|
|
|
|
//~ '&text='.urlencode($msg->message->text."\n_".$msg->message->chat->username."_").
|
|
|
|
|
//~ "&parse_mode=".urlencode("Markdown"); //bah, un isset un ce lo vedrei male
|
|
|
|
|
//~ $result = file_get_contents($query);
|
|
|
|
|
|
|
|
|
|
// A new test
|
|
|
|
|
forwardMessage(API_CHANNEL_ID, $msg->message->chat->id, $msg->message->message_id, true);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if (isset($msg->message->text)) {
|
|
|
|
|
$result = sendMessage(API_CHANNEL_ID,
|
|
|
|
|
$msg->message->text."\n_".$msg->message->chat->username."_",
|
|
|
|
@ -243,7 +249,7 @@ if (isset ($row->callback_query)) {
|
|
|
|
|
sendPhoto(API_CHANNEL_ID,$msg->message->photo[0]->file_id,
|
|
|
|
|
isset($msg->message->caption) ? $msg->message->caption : null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
// Remove kbd
|
|
|
|
|
$text = "Invio effettuato correttamente";
|
|
|
|
|
editMessageText($chatID, $inlineID, $text);
|
|
|
|
@ -466,9 +472,17 @@ if (isset ($row->callback_query)) {
|
|
|
|
|
$value .= $currentTab['day'].' ';
|
|
|
|
|
$value .= $callback_data.":00:00'";
|
|
|
|
|
$value .= ",";
|
|
|
|
|
$value .= "'".$sql->escape_string($msg->message->text)."'";
|
|
|
|
|
if (isset($msg->message->text))
|
|
|
|
|
$value .= "'".$sql->escape_string($msg->message->text)."'";
|
|
|
|
|
else
|
|
|
|
|
$value .= "''";
|
|
|
|
|
$value .= ",";
|
|
|
|
|
$value .= "'".$sql->escape_string($msg->message->from->username)."'"; // andrebbe fatto un isset, vabbé
|
|
|
|
|
if (isset($msg->message->forward_from->username))
|
|
|
|
|
$value .= "'".$sql->escape_string($msg->message->forward_from->username)."'";
|
|
|
|
|
elseif (isset($msg->message->from->username))
|
|
|
|
|
$value .= "'".$sql->escape_string($msg->message->from->username)."'";
|
|
|
|
|
else
|
|
|
|
|
$value .= "''";
|
|
|
|
|
$value .= ");";
|
|
|
|
|
|
|
|
|
|
info("Saving post in ".MYSQL_TABLE.", scheduled date: ".$value);
|
|
|
|
@ -550,7 +564,7 @@ elseif (isset($row->message)) {
|
|
|
|
|
die();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as DateTime,Text,Author,ID FROM ".MYSQL_TABLE."
|
|
|
|
|
$query = $sql->query("SELECT DATE_FORMAT(DateTime,'%d/%m/%Y ore %H') as ChatID, MessageID,DateTime,Text,Author,ID FROM ".MYSQL_TABLE."
|
|
|
|
|
ORDER BY DateTime ASC LIMIT 1") or error("Can't make the query, SQL error ".$sql->error);
|
|
|
|
|
|
|
|
|
|
//while($row = $query->fetch_assoc()) {
|
|
|
|
@ -592,15 +606,21 @@ elseif (isset($row->message)) {
|
|
|
|
|
"inline_keyboard" => $container);
|
|
|
|
|
$reply = json_encode($resp);
|
|
|
|
|
|
|
|
|
|
$text="$row[Text]\n_$row[Author]_"; // NOME CANALE ".API_CHANNEL_ID."?";
|
|
|
|
|
if ($row[Text] != ''){
|
|
|
|
|
$text="$row[Text]\n_$row[Author]_"; // NOME CANALE ".API_CHANNEL_ID."?";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
$text="Non testo puro";
|
|
|
|
|
|
|
|
|
|
$query = API_URL.API_TOKEN."/sendmessage?chat_id=".($chatID).
|
|
|
|
|
"&text=".urlencode($text).
|
|
|
|
|
"&parse_mode=".urlencode("Markdown").
|
|
|
|
|
"&reply_markup=".$reply;
|
|
|
|
|
"&text=".urlencode($text).
|
|
|
|
|
"&parse_mode=".urlencode("Markdown").
|
|
|
|
|
"&reply_markup=".$reply;
|
|
|
|
|
$answer = file_get_contents($query);
|
|
|
|
|
$answer = json_decode($answer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forwardMessage(API_CHANNEL_ID, $row['ChatID'], $row['MessageID']);
|
|
|
|
|
|
|
|
|
|
$mc->set($chatID.MC_INLINE_ID, $answer->result->message_id)
|
|
|
|
|
or $mc->replace($chatID.MC_INLINE_ID, $answer->result->message_id);
|
|
|
|
|
|
|
|
|
@ -624,6 +644,10 @@ elseif (isset($row->message)) {
|
|
|
|
|
array(
|
|
|
|
|
"text" => "NO ".$EMOJI_THUMBSDOWN,
|
|
|
|
|
"callback_data" => MSG_NO
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
"text" => "Programma ".$EMOJI_CLOCK,
|
|
|
|
|
"callback_data" => MSG_SCHEDULE
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
@ -640,11 +664,7 @@ elseif (isset($row->message)) {
|
|
|
|
|
}
|
|
|
|
|
// A common text message
|
|
|
|
|
elseif (isset($row->message->text)) {
|
|
|
|
|
$container[0][] =
|
|
|
|
|
array(
|
|
|
|
|
"text" => "Programma ".$EMOJI_CLOCK,
|
|
|
|
|
"callback_data" => MSG_SCHEDULE
|
|
|
|
|
);
|
|
|
|
|
//.... nothing
|
|
|
|
|
}
|
|
|
|
|
// else... this is not supported
|
|
|
|
|
else {
|
|
|
|
|