Bot-Cobalt
view release on metacpan or search on metacpan
lib/Bot/Cobalt/Core/Role/Timers.pm view on Meta::CPAN
} else {
## Assume we were passed a simple string.
$ev = { Event => $ev };
}
}
my $timer = Bot::Cobalt::Timer->new;
$timer->id($id) if $id;
## Try to guess type, or default to 'event'
my $type = $ev->{Type};
unless ($type) {
if (defined $ev->{Text} && defined $ev->{Context}) {
$type = 'msg'
} else {
$type = 'event'
}
}
my($event_name, @event_args);
lib/Bot/Cobalt/Timer.pm view on Meta::CPAN
isa => Str,
predicate => 'has_target'
);
has type => (
lazy => 1,
is => 'rw',
isa => Str,
builder => sub {
my ($self) = @_;
# best guess:
$self->has_context && $self->has_target ? 'msg' : 'event'
},
coerce => sub {
$_[0] =~ /message|privmsg/i ? 'msg' : lc($_[0]) ;
},
);
sub _process_type {
my ($self) = @_;
lib/Bot/Cobalt/Timer.pm view on Meta::CPAN
=head3 type
The type of event.
Valid types as of this writing are B<msg>, B<action>, and B<event>.
B<msg> and B<action> types require L</context>, L</text>, and L</target>
attributes be specified.
If no type has been specified for this timer, B<type()> returns our best
guess; for timed events carrying a L</context> and L</target> the
default is B<msg>.
This is used to set up proper event names for special timer types.
=head3 context
B<msg and action timer types only>
The server context for an outgoing B<msg> or B<action>.
( run in 0.963 second using v1.01-cache-2.11-cpan-748bfb374f4 )