| 1 | package Amethyst::Brain::Infobot::Module::BabyTime; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use vars qw(@ISA $ZONEDIR); | ||
| 5 | use Date::Format; | ||
| 6 | use Text::Soundex; | ||
| 7 | use Amethyst::Brain::Infobot::Module; | ||
| 8 | use Acme::Time::Baby; # (language => 'swedish chef'); | ||
| 9 | |||
| 10 | @ISA = qw(Amethyst::Brain::Infobot::Module); | ||
| 11 | |||
| 12 | sub new { | ||
| 13 | my $class = shift; | ||
| 14 | |||
| 15 | my $self = $class->SUPER::new( | ||
| 16 | Name => 'BabyTime', | ||
| 17 | # Regex => qr/^(what is the? )?babytime/i, | ||
| 18 | Usage => '(what is the )? babytime in <language>', | ||
| 19 | Description => "Print the time for babies.", | ||
| 20 | @_ | ||
| 21 | ); | ||
| 22 | return bless $self, $class; | ||
| 23 | } | ||
| 24 | |||
| 25 | sub process { | ||
| 26 | my ($self, $message) = @_; | ||
| 27 | |||
| 28 | my $content = lc $message->content; | ||
| 29 | $content =~ s/\s+/ /g; | ||
| 30 | |||
| 31 | $content =~ s/^what is the //; | ||
| 32 | return undef unless $content =~ /^babytime/; | ||
| 33 | |||
| 34 | my $reply = $self->reply_to($message, babytime); | ||
| 35 | $reply->send; | ||
| 36 | |||
| 37 | return 1; | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; |