No need for arguments in paybill anymore
authorCameron Ball <cameron@cameron1729.xyz>
Fri, 21 Dec 2018 03:08:17 +0000 (11:08 +0800)
committerCameron Ball <cameron@cameron1729.xyz>
Fri, 28 Dec 2018 06:27:20 +0000 (14:27 +0800)
purjolok.php

index f85ebca..73b43f1 100644 (file)
@@ -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
+                ]
+            );
         }
     }