# Type: Input # Category: Config # Description: Configures work time hours # Author: Andriy Lesyuk new Orangutan::Context( response => [ '^I (?:begin|start) (?:to )?work(?:ing)? at ([0-9]{1,2}(?:[:-][0-9]{2})? *(?:(?:a\.?|p\.?)m\.?)?)!*\.*$', '^(?:My )?work *(?:day|time)? starts at ([0-9]{1,2}(?:[:-][0-9]{2})? *(?:(?:a\.?|p\.?)m\.?)?)!*\.*$' ], handler => sub { my ($context, $user, $item, $time) = @_; my $date = new Orangutan::Date($time); if ($date) { my ($hour, $min) = $date->GetTime; if ($min == 0) { if ($hour == $user->GetWorkTimeStart) { $user->SendMessage([ 'Seems you already told me...', 'I know...' ]); } else { $user->SetWorkTimeStart($hour); $main::config->Context('Ok')->Tell($user); } } else { $user->SendMessage([ "Minutes are not supported yet (and won't ever be prehaps).", "Wow! I'm not going to support minutes... Sorry!", 'You need to specify just hours.' ]); } } else { $user->SendMessage([ 'I guess you made a mistake in time...', "I don't think it's a valid time..." ]); } }, help => { title => 'How can I specify when my work day starts?', question => [ '^(?:How )?(?:(?:can|do) I |to )specify (?:when|(?:in|at) what time) '. '(?:my )?work(?:ing)?[ -]?(?:day|time) (?:start|begin)s\?*!*\.*$', '^(?:How )?(?:(?:can|do) I |to )(?:specify|change|set) (?:the )?start(?: time)? '. 'of (?:my )?work(?:ing)?[ -]?(?:day|time)\?*!*\.*$' ], answer => "To assist you better Orangutan needs to know when your work day starts and how much hours it lasts. ". "By default Orangutan assumes that you start working at 10:00am.\n". "Sample requests to change this:\n". " o My work day starts at 10:00\n". " o I start working at 14:00", weight => 540 } ); # kate: syntax perl