# Type: Input # Category: Config # Description: Lets user specify his working week days # Author: Andriy Lesyuk new Orangutan::Context( response => [ '^(?:(?:(?:From|since) )?now )?I(?: do)? work (?:on|at) '. '(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)s?(?:(?: (?:from|since))? now)?!*\.*$', '^(?:(?:(?:From|since) )?now )?I do(?:n\'t| not) work (?:on|at) '. '(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)s?(?:(?: (?:from|since))? now)?!*\.*$' ], handler => sub { my ($context, $user, $item, $weekday) = @_; my $wday = Orangutan::Date::ParseWeekDay($weekday); if (defined($wday)) { my $result; if ($item == 1) { $result = $user->SetWorkWeekDay($wday); } else { $result = $user->SetFreeWeekDay($wday); } if ($result) { $user->SendMessage([ 'Ok...', 'I see...', 'Got it!..' ]); } else { $user->SendMessage([ 'This is what I thought...', 'I knew this.', 'I know...' ]); } } else { $user->SendMessage([ 'I accept only week days...', "I'm glad for you..." ]); } }, help => { title => 'How can I specify working week days?', question => '^(?:How )?(?:(?:can|do) I |to )(?:specify|select) working (?:week ?)?days?\?*!*\.*$', answer => "If you do not work on Mondays for example you can tell Orangutan not to disturb you on this day:\n". " o I do not work on Mondays\n". "And if you started to work on Mondays:\n". " o From now I work on Mondays", weight => 560, } ); # kate: syntax perl