====== Matrix bot task: Celtic game warning ====== I want to know if the pub is gonna be busy or if certain friends might not be available, so I need to know when Celtic games are on. The first hit when I searched 'celtic games' was this [[https://www.skysports.com/celtic-fixtures|Sky Sports: Celtic Fixtures]] page. Luckily they provide an iCal feed of the games. I used the [[https://sabre.io/vobject/icalendar/|Sabre VObject PHP class]] to parse their [[webcal://www.skysports.com/calendars/football/fixtures/teams/celtic?live=false|calendar file]]. Install VObject using composer: cd projectdir composer require sabre/vobject ~4.1 VEVENT as $event) { $date = substr($event->DTSTART,0,8); if($today == $date) { $time = substr($event->DTSTART,8,12); $str .= "Warning: Celtic game today at "; $str .= date("g:ia", strtotime($time)); $str .= " ("; $str .= $event->SUMMARY; $str .= ")"; $str .= "\n"; } } if(!empty($str)) { require("matrix.class.php"); $mat = new matrix(); $room = "#glasgow"; $mat->post($str, $room); } That runs once a day, in the morning and warns me in the main #glasgow channel. It uses my [[Matrix PHP class]] to post.