diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 569707ba..0e22940a 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -57,6 +57,25 @@ sub initialize { $pbot->commands->register(sub { return $self->disable_command(@_) }, "disable", 10); $pbot->commands->register(sub { return $self->factset(@_) }, "factset", 10); $pbot->commands->register(sub { return $self->factunset(@_) }, "factunset", 10); + $pbot->commands->register(sub { return $self->call_factoid(@_) }, "fact", 0); +} + +sub call_factoid { + my $self = shift; + my ($from, $nick, $user, $host, $arguments) = @_; + my ($chan, $keyword, $args) = split / /, $arguments, 3; + + if(not defined $chan or not defined $keyword) { + return "Usage: !fact [arguments]"; + } + + my ($channel, $trigger) = $self->{pbot}->factoids->find_factoid($chan, $keyword, $args, 1); + + if(not defined $trigger) { + return "No such factoid '$keyword' exists for channel '$chan'"; + } + + return $self->{pbot}->factoids->interpreter($channel, $nick, $user, $host, 1, $trigger, $args); } sub factset { diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index b9c8281d..8c0caad9 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,7 +13,7 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 191, + BUILD_REVISION => 192, BUILD_DATE => "2010-06-21", };