From 2b0b62c3b1ea1a869d497d9799792bf34c5b263f Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Fri, 21 Dec 2018 11:08:17 +0800 Subject: [PATCH] No need for arguments in paybill anymore --- purjolok.php | 52 +++++++++++++++++++++++++--------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/purjolok.php b/purjolok.php index f85ebca..73b43f1 100644 --- a/purjolok.php +++ b/purjolok.php @@ -127,33 +127,31 @@ getTelegram()->addCommand( protected $description = 'Mark a bill as paid'; public function handle($arguments) { - if (!$arguments) { - $buttons = [array_values(map(function($bill) { - return sprintf('%s%s', hide('[billid]' . $bill['id'] . '[billid]'), $bill['service'] . ' ($' . splitBill($bill['amount']) . ')'); - })(getMessagesFromInbox( - getInbox( - 'Utilities/' . getMessageSender($this->getUpdate()) . ' To Pay' - ), - require 'rules.php', - FALSE - )))]; - - $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?', - 'parse_mode' => 'markdown', - 'reply_markup' => $reply_markup - ] - ); - } + $buttons = [array_values(map(function($bill) { + return sprintf('%s%s', hide('[billid]' . $bill['id'] . '[billid]'), $bill['service'] . ' ($' . splitBill($bill['amount']) . ')'); + })(getMessagesFromInbox( + getInbox( + 'Utilities/' . getMessageSender($this->getUpdate()) . ' To Pay' + ), + require 'rules.php', + FALSE + )))]; + + $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?', + 'parse_mode' => 'markdown', + 'reply_markup' => $reply_markup + ] + ); } } -- 2.11.0