From 9b2c374bbbf5bc03df9334507e51cdcd84e14fbd Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 3 Mar 2014 10:33:34 +0000 Subject: [PATCH] Use export_site properly in Quotegrabs.pm --- PBot/Factoids.pm | 2 +- PBot/Quotegrabs.pm | 27 ++++++++++----------------- PBot/VERSION.pm | 2 +- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 082f3c3b..1859bced 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -38,7 +38,7 @@ sub initialize { my $export_path = delete $conf{export_path}; my $export_site = delete $conf{export_site}; - my $pbot = delete $conf{pbot} || Carp::croak("Missing pbot reference to Factoids"); + my $pbot = delete $conf{pbot} // Carp::croak("Missing pbot reference to Factoids"); $self->{factoids} = PBot::DualIndexHashObject->new(name => 'Factoids', filename => $filename); $self->{export_path} = $export_path; diff --git a/PBot/Quotegrabs.pm b/PBot/Quotegrabs.pm index 6b156ef3..65f0db14 100644 --- a/PBot/Quotegrabs.pm +++ b/PBot/Quotegrabs.pm @@ -32,29 +32,22 @@ sub new { sub initialize { my ($self, %conf) = @_; - my $pbot = delete $conf{pbot}; - if(not defined $pbot) { - Carp::croak("Missing pbot reference to Quotegrabs"); - } - - my $filename = delete $conf{filename}; - my $export_path = delete $conf{export_path}; - - $self->{pbot} = $pbot; - $self->{filename} = $filename; - $self->{export_path} = $export_path; + $self->{pbot} = delete $conf{pbot} // Carp::croak("Missing pbot reference in Quotegrabs"); + $self->{filename} = delete $conf{filename}; + $self->{export_path} = delete $conf{export_path}; + $self->{export_site} = delete $conf{export_site}; $self->{quotegrabs} = []; #------------------------------------------------------------------------------------- # The following could be in QuotegrabsCommands.pm, or they could be kept in here? #------------------------------------------------------------------------------------- - $pbot->commands->register(sub { $self->grab_quotegrab(@_) }, "grab", 0); - $pbot->commands->register(sub { $self->show_quotegrab(@_) }, "getq", 0); - $pbot->commands->register(sub { $self->delete_quotegrab(@_) }, "delq", 0); - $pbot->commands->register(sub { $self->show_random_quotegrab(@_) }, "rq", 0); + $self->{pbot}->commands->register(sub { $self->grab_quotegrab(@_) }, "grab", 0); + $self->{pbot}->commands->register(sub { $self->show_quotegrab(@_) }, "getq", 0); + $self->{pbot}->commands->register(sub { $self->delete_quotegrab(@_) }, "delq", 0); + $self->{pbot}->commands->register(sub { $self->show_random_quotegrab(@_) }, "rq", 0); # ought to be in MessageTracker.pm once we create that module - $pbot->commands->register(sub { $self->recall_message(@_) }, "recall", 0); + $self->{pbot}->commands->register(sub { $self->recall_message(@_) }, "recall", 0); } sub load_quotegrabs { @@ -201,7 +194,7 @@ sub export_quotegrabs() { print FILE "\n"; print FILE "\n\n"; close(FILE); - return "$i quotegrabs exported to http://blackshell.com/~msmud/candide/quotegrabs.html"; + return "$i quotegrabs exported to " . $self->{export_site}; } # ---------------------------------------------------------------------------------------- diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index 3f343cf5..be20a51c 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 => 495, + BUILD_REVISION => 496, BUILD_DATE => "2014-03-03", };