From: Cameron Ball Date: Sun, 18 Nov 2018 04:26:56 +0000 (+0800) Subject: Don't need the commands classes anymore X-Git-Url: http://git.cameron1729.xyz/?p=SonOfLokstallBot.git;a=commitdiff_plain;h=123279992c7ea86dc726da537b37b1720292c85a Don't need the commands classes anymore --- diff --git a/Commands/MyBills.php b/Commands/MyBills.php deleted file mode 100644 index e6aaf8f..0000000 --- a/Commands/MyBills.php +++ /dev/null @@ -1,105 +0,0 @@ -format('jS') - ); - }, - $rules - ), function($message) { - return !!$message; - }); - } - - public function handle($arguments) - { - - if ((int)$this->getUpdate()->get('message')->get('from')->get('id') == self::CAM) { - $inbox = 'Utilities/Cam To Pay'; - } elseif ((int)$this->getUpdate()->get('message')->get('from')->get('id') == self::ASH) { - $inbox = 'Utilities/Ash To Pay'; - } - - $mailbox = '{imap.gmail.com:993/debug/imap/ssl/novalidate-cert}' . $inbox; - $username = 'molelord@gmail.com'; - $password = '#NiceMeme420!'; - - $memes = [ - 'Electricity' => [ - 'imapQuery' => 'FROM "@synergy.net.au"', - 'regex' => '/New charges: \$(?[0-9]+(\.[0-9]{2})?) Due (?\d{1,2} \w{3} \d+)/', - 'messageTransform' => 'identity', - 'dateTransform' => 'identity', - 'telegramMessage' => "Electricity bill: $%s each due on the %s" - ], - 'Water' => [ - 'imapQuery' => 'FROM "@watercorporation.com.au"', - 'regex' => '/Due date:.*(?\d{1,2}\/\d{2}\/\d{4}).*Amount to pay:.*\$(?[0-9]+(\.[0-9]{2})?)/', - 'messageTransform' => function($message) { - return implode(" ", array_map('trim', explode("\n", strip_tags(base64_decode($message))))); - }, - 'dateTransform' => function($date) { - return str_replace('/', '-', $date); - }, - 'telegramMessage' => "Water bill: $%s each due on the %s" - ], - 'Internet' => [ - 'imapQuery' => 'FROM "@online.telstra.com"', - 'regex' => '/Total \$(?[0-9]+(\.[0-9]{2})?).*Due Date (?\d{1,2} \w{3} \d{4})/', - 'messageTransform' => function($message) { - return implode(" ", array_map('trim', explode("\n", strip_tags(html_entity_decode($message))))); - }, - 'dateTransform' => 'identity', - 'telegramMessage' => "Internet bill: $%s each due on the %s" - ], - 'Gas' => [ - 'imapQuery' => 'FROM "@energy.agl.com.au"', - 'regex' => '/Direct Debit amount: \$(?[0-9]+(\.[0-9]{2})?).*Direct Debit date: (?\d{1,2} \w{3} \d+)/', - 'messageTransform' => function($message) { - return implode(" ", array_map('trim', explode("\n", $message))); - }, - 'dateTransform' => 'identity', - 'telegramMessage' => "Gas bill: $%s each due on the %s" - ] - ]; - - $imapResource = imap_open($mailbox, $username, $password); - $messages = $this->generateMessages($imapResource, $memes); - $this->replyWithMessage(['text' => $this->getUpdate()->get('message')->get('from')->get('id')]); - } -} \ No newline at end of file diff --git a/common.php b/common.php index 17f6800..5244cfe 100644 --- a/common.php +++ b/common.php @@ -3,7 +3,6 @@ namespace Common; require 'vendor/autoload.php'; -require 'Commands/MyBills.php'; require '../../config.php'; use Telegram\Bot\Api;