imap_delete(getInbox('Utilities/' . getMessageSender(getTelegram()->getWebhookUpdates()) . ' To Pay'), $messages[0]['uid'], FT_UID);
getTelegram()->sendMessage([
'chat_id' => getTelegram()->getWebhookUpdates()->get('message')->get('chat')->get('id'),
- 'text' => "I marked " . getMessageSenderDisplayName(getTelegram()->getWebHookUpdates()) . " as having paid the " . strtolower($messages[0]['service']) . " bill, thanks!"
+ 'text' => "I marked " . getMessageSenderDisplayName(getTelegram()->getWebHookUpdates()) . " as having paid the " . strtolower($messages[0]['service']) . " bill, thanks!",
+ 'reply_markup' => json_encode(['remove_keyboard' => true])
]);
}
FALSE
)))];
+ error_log(print_r($buttons, true));
+
+ if (!$buttons[0]) {
+ $this->replyWithMessage([
+ 'text' => getMessageSenderDisplayName($this->getUpdate()). ' doesn\'t have any outstanding bills. Nice :)',
+ 'reply_markup' => json_encode(['remove_keyboard' => true])
+ ]);
+ return;
+ }
+
$reply_markup = getTelegram()->replyKeyboardMarkup([
'keyboard' => $buttons,
'resize_keyboard' => true,
'one_time_keyboard' => true,
- 'remove_keyboard' => true,
'selective' => true
]);
$this->replyWithMessage(
[
- 'text' => '[' . getMessageSenderDisplayName($this->getUpdate()) . '](tg://user?id=' . getMessageSender($this->getUpdate()) . '), which bill did you want to pay?',
+ 'text' => '[' . getMessageSenderDisplayName($this->getUpdate()) . '](tg://user?id=' . getMessageSenderId($this->getUpdate()) . '), which bill did you want to pay?',
'parse_mode' => 'markdown',
'reply_markup' => $reply_markup
]