Update date format to include the month
[SonOfLokstallBot.git] / rules.php
1 <?php declare(strict_types=1);
2
3 return [
4 'Electricity' => [
5 'imapQuery' => 'FROM "@synergy.net.au"',
6 'regex' => '/New charges: \$(?<amount>[0-9]+(\.[0-9]{2})?) Due (?<due>\d{1,2} \w{3} \d+)/',
7 'messageTransform' => 'Common\identity',
8 'dateTransform' => 'Common\identity',
9 'telegramMessage' => "Electricity bill: $%s each due on the %s"
10 ],
11 'Water' => [
12 'imapQuery' => 'FROM "@watercorporation.com.au"',
13 'regex' => '/Due date:.*?(?<due>\d{1,2}\/\d{2}\/\d{4}).*?Amount to pay:.*\$(?<amount>[0-9]+(\.[0-9]{2})?)/',
14 'messageTransform' => function($message) {
15 return implode(" ", array_map('trim', explode("\n", strip_tags(base64_decode($message)))));
16 },
17 'dateTransform' => function($date) {
18 return str_replace('/', '-', $date);
19 },
20 'telegramMessage' => "Water bill: $%s each due on the %s"
21 ],
22 'Internet' => [
23 'imapQuery' => 'FROM "@online.telstra.com"',
24 'regex' => '/Total \$(?<amount>[0-9]+(\.[0-9]{2})?).*?Due Date (?<due>\d{1,2} \w{3} \d{4})/',
25 'messageTransform' => function($message) {
26 return implode(" ", array_map('trim', explode("\n", strip_tags(html_entity_decode($message)))));
27 },
28 'dateTransform' => 'Common\identity',
29 'telegramMessage' => "Internet bill: $%s each due on the %s"
30 ],
31 'Gas' => [
32 'imapQuery' => 'FROM "@energy.agl.com.au"',
33 'regex' => '/Direct Debit amount: \$(?<amount>[0-9]+(\.[0-9]{2})?).*?Direct Debit date: (?<due>\d{1,2} \w{3} \d+)/',
34 'messageTransform' => function($message) {
35 return implode(" ", array_map('trim', explode("\n", $message)));
36 },
37 'dateTransform' => 'Common\identity',
38 'telegramMessage' => "Gas bill: $%s each due on the %s"
39 ]
40 ];