# Type: Input # Category: Config # Description: Configures work time hours # Author: Andriy Lesyuk new Orangutan::Context( response => [ '^I work ([0-9]{1,2}) hours(?: per (?:work(?:ing)?[ -]?)?day)?!*\.*', '^I work (full|half|part)[ -]time!*\.*$' ], handler => sub { my ($context, $user, $item, $time) = @_; my $hours = 0; if ($item == 1) { if ($time < 13) { $hours = $time; } else { $user->SendMessage([ 'You need to do something with it!', "Wow! I can't accept this...", 'I believe you are wrong...', "Hey! That's too much!" ]); return; } } else { if (lc($time) eq 'full') { $hours = 8; } elsif (lc($time) eq 'half') { $hours = 4; } } if ($hours == $user->GetWorkTimeHours) { $user->SendMessage([ 'Seems you already told.', 'I know...' ]); } else { $user->SetWorkTimeHours($hours); if ($hours == 0) { my $message = Orangutan::Context::Random('Ok...', 'Got it!..', 'I see...'); $message .= ' '.Orangutan::Context::Random( 'Assuming that you do not need to work a fixed number of hours per day.', 'Assuming that your work is hours based.' ); $user->SendMessage($message); } else { $user->SendMessage([ 'Ok...', 'I see...', 'Got it!..' ]); } } }, help => { title => 'How can I specify how many hours I should work per day?', question => [ '^(?:How )?(?:(?:can|do) I |to )(?:specify|change) (?:how (?:many|much) )?(?:hours|time) '. 'I(?:\'m| am)? (?:should|need|must|required|have)(?: to)? work(?: per (?:work(?:ing)?[ -]?)?day)?\?*!*\.*$', '^(?:How )?(?:(?:can|do) I |to )(?:specify|change|set) (?:my )?work(?:ing)?[ -]?(?:time|day) hours\?*!*\.*$' ], answer => "To assist you better Orangutan needs to know how many hours do you work per day. ". "If not specified it assumes that you work 8 hours. ". "In terms of Orangutan full time is 8 hours, half time is 4 hours and ". "part time means variable number of hours.\n". "Sample requests:\n". " o I work 2 hours per day\n". " o I work full time\n". " o I work half time\n". " o I work part time\n". " o I work 6 hours", weight => 550 } ); # kate: syntax perl