From b289fd155e0635bce8bea28a223c70f874a58925 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 29 Dec 2014 23:15:46 -0800 Subject: [PATCH] Add repo_module to registry to customize source URL in factinfo command --- PBot/FactoidCommands.pm | 5 ++++- PBot/VERSION.pm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index cff3bd0e..4f1ce60b 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -53,6 +53,8 @@ sub initialize { } $self->{pbot} = $pbot; + + $pbot->{registry}->add_default('text', 'general', 'module_repo', $conf{module_repo} // 'https://github.com/pragma-/pbot/blob/master/modules/'); $pbot->{commands}->register(sub { return $self->factadd(@_) }, "learn", 0); $pbot->{commands}->register(sub { return $self->factadd(@_) }, "factadd", 0); @@ -587,7 +589,8 @@ sub factinfo { # module if($factoids->{$channel}->{$trigger}->{type} eq 'module') { - return "$trigger: Module loaded by " . $factoids->{$channel}->{$trigger}->{owner} . " for $chan on " . localtime($factoids->{$channel}->{$trigger}->{created_on}) . " [$created_ago] -> http://code.google.com/p/pbot2-pl/source/browse/trunk/modules/" . $factoids->{$channel}->{$trigger}->{action} . ", used " . $factoids->{$channel}->{$trigger}->{ref_count} . " times (last by " . $factoids->{$channel}->{$trigger}->{ref_user} . (exists $factoids->{$channel}->{$trigger}->{last_referenced_on} ? " on " . localtime($factoids->{$channel}->{$trigger}->{last_referenced_on}) . " [$ref_ago]" : "") . ")"; + my $module_repo = $self->{pbot}->{registry}->get_value('general', 'module_repo'); + return "$trigger: Module loaded by " . $factoids->{$channel}->{$trigger}->{owner} . " for $chan on " . localtime($factoids->{$channel}->{$trigger}->{created_on}) . " [$created_ago] -> $module_repo" . $factoids->{$channel}->{$trigger}->{action} . ", used " . $factoids->{$channel}->{$trigger}->{ref_count} . " times (last by " . $factoids->{$channel}->{$trigger}->{ref_user} . (exists $factoids->{$channel}->{$trigger}->{last_referenced_on} ? " on " . localtime($factoids->{$channel}->{$trigger}->{last_referenced_on}) . " [$ref_ago]" : "") . ")"; } # regex diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index d6daf6ec..e514a0f5 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 => 808, + BUILD_REVISION => 810, BUILD_DATE => "2014-12-29", };