mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 13:59:47 +01:00
Remove unnecessary return statements
This commit is contained in:
parent
bc98a7642a
commit
6424e7c601
@ -77,8 +77,8 @@ sub initialize {
|
||||
|
||||
$self->{pbot}->{registry}->add_default('text', 'antiflood', 'debug_checkban', $conf{debug_checkban} // 0);
|
||||
|
||||
$self->{pbot}->{commands}->register(sub { return $self->unbanme(@_) }, "unbanme", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->whitelist(@_) }, "whitelist", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->unbanme(@_) }, "unbanme", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->whitelist(@_) }, "whitelist", 1);
|
||||
$self->{pbot}->{capabilities}->add('admin', 'can-whitelist', 1);
|
||||
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.whoisaccount', sub { $self->on_whoisaccount(@_) });
|
||||
|
@ -41,7 +41,7 @@ sub initialize {
|
||||
$self->{keywords}->load;
|
||||
|
||||
$self->{pbot}->{registry}->add_default('text', 'antispam', 'enforce', $conf{enforce_antispam} // 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->antispam_cmd(@_) }, "antispam", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->antispam_cmd(@_) }, "antispam", 1);
|
||||
$self->{pbot}->{capabilities}->add('admin', 'can-antispam', 1);
|
||||
}
|
||||
|
||||
|
@ -31,19 +31,19 @@ sub initialize {
|
||||
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||
|
||||
# register commands
|
||||
$self->{pbot}->{commands}->register(sub { return $self->ban_user(@_) }, "ban", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->unban_user(@_) }, "unban", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->mute_user(@_) }, "mute", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->unmute_user(@_) }, "unmute", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->kick_user(@_) }, "kick", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->checkban(@_) }, "checkban", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->checkmute(@_) }, "checkmute", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->op_user(@_) }, "op", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->deop_user(@_) }, "deop", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->voice_user(@_) }, "voice", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->devoice_user(@_) }, "devoice", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->mode(@_) }, "mode", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->invite(@_) }, "invite", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->ban_user(@_) }, "ban", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->unban_user(@_) }, "unban", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->mute_user(@_) }, "mute", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->unmute_user(@_) }, "unmute", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->kick_user(@_) }, "kick", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->checkban(@_) }, "checkban", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->checkmute(@_) }, "checkmute", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->op_user(@_) }, "op", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->deop_user(@_) }, "deop", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->voice_user(@_) }, "voice", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->devoice_user(@_) }, "devoice", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->mode(@_) }, "mode", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->invite(@_) }, "invite", 1);
|
||||
|
||||
# allow commands to set modes
|
||||
$self->{pbot}->{capabilities}->add('can-ban', 'can-mode-b', 1);
|
||||
@ -99,9 +99,9 @@ sub initialize {
|
||||
$self->{invites} = {}; # track who invited who in order to direct invite responses to them
|
||||
|
||||
# handle invite responses
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.inviting', sub { return $self->on_inviting(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.useronchannel', sub { return $self->on_useronchannel(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.nosuchnick', sub { return $self->on_nosuchnick(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.inviting', sub { $self->on_inviting(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.useronchannel', sub { $self->on_useronchannel(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.nosuchnick', sub { $self->on_nosuchnick(@_) });
|
||||
}
|
||||
|
||||
sub on_inviting {
|
||||
|
@ -60,31 +60,31 @@ sub initialize {
|
||||
|
||||
$self->{pbot}->{registry}->add_default('text', 'general', 'module_repo', $conf{module_repo} // 'https://github.com/pragma-/pbot/blob/master/modules/');
|
||||
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factadd(@_) }, "learn", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factadd(@_) }, "factadd", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factrem(@_) }, "forget", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factrem(@_) }, "factrem", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factshow(@_) }, "factshow", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factinfo(@_) }, "factinfo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factlog(@_) }, "factlog", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factundo(@_) }, "factundo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factredo(@_) }, "factredo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factset(@_) }, "factset", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factunset(@_) }, "factunset", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factchange(@_) }, "factchange", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factalias(@_) }, "factalias", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factmove(@_) }, "factmove", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->call_factoid(@_) }, "fact", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->factfind(@_) }, "factfind", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->top20(@_) }, "top20", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->load_module(@_) }, "load", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->unload_module(@_) }, "unload", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->histogram(@_) }, "histogram", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->count(@_) }, "count", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factadd(@_) }, "learn", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factadd(@_) }, "factadd", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factrem(@_) }, "forget", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factrem(@_) }, "factrem", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factshow(@_) }, "factshow", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factinfo(@_) }, "factinfo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factlog(@_) }, "factlog", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factundo(@_) }, "factundo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factredo(@_) }, "factredo", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factset(@_) }, "factset", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factunset(@_) }, "factunset", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factchange(@_) }, "factchange", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factalias(@_) }, "factalias", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factmove(@_) }, "factmove", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->call_factoid(@_) }, "fact", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->factfind(@_) }, "factfind", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->top20(@_) }, "top20", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->load_module(@_) }, "load", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->unload_module(@_) }, "unload", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->histogram(@_) }, "histogram", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->count(@_) }, "count", 0);
|
||||
|
||||
# the following commands have not yet been updated to use the new factoid structure
|
||||
# DO NOT USE!! Factoid corruption may occur.
|
||||
$self->{pbot}->{commands}->register(sub { return $self->add_regex(@_) }, "regex", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->add_regex(@_) }, "regex", 1);
|
||||
}
|
||||
|
||||
sub call_factoid {
|
||||
|
@ -38,7 +38,7 @@ sub new {
|
||||
sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->do_func(@_) }, 'func', 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->do_func(@_) }, 'func', 0);
|
||||
$self->init_funcs;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ sub initialize {
|
||||
'lag_history_interval'
|
||||
);
|
||||
|
||||
$self->{pbot}->{commands}->register(sub { return $self->lagcheck(@_) }, "lagcheck", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->lagcheck(@_) }, "lagcheck", 0);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.pong', sub { $self->on_pong(@_) });
|
||||
}
|
||||
|
||||
|
@ -216,8 +216,8 @@ sub initialize {
|
||||
$self->{parsedate} = PBot::Utils::ParseDate->new(pbot => $self, %conf);
|
||||
|
||||
$self->{interpreter} = PBot::Interpreter->new(pbot => $self, %conf);
|
||||
$self->{interpreter}->register(sub { return $self->{commands}->interpreter(@_); });
|
||||
$self->{interpreter}->register(sub { return $self->{factoids}->interpreter(@_); });
|
||||
$self->{interpreter}->register(sub { $self->{commands}->interpreter(@_) });
|
||||
$self->{interpreter}->register(sub { $self->{factoids}->interpreter(@_) });
|
||||
|
||||
$self->{factoids} = PBot::Factoids->new(pbot => $self, filename => "$data_dir/factoids", %conf);
|
||||
|
||||
|
@ -31,7 +31,7 @@ sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||
$self->{refresher} = Module::Refresh->new;
|
||||
$self->{pbot}->{commands}->register(sub { return $self->refresh(@_) }, "refresh", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->refresh(@_) }, "refresh", 1);
|
||||
}
|
||||
|
||||
sub refresh {
|
||||
|
@ -32,13 +32,13 @@ sub initialize {
|
||||
$self->{users} = PBot::DualIndexHashObject->new(name => 'Users', filename => $conf{filename}, pbot => $conf{pbot});
|
||||
$self->load;
|
||||
|
||||
$self->{pbot}->{commands}->register(sub { return $self->logincmd(@_) }, "login", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->logoutcmd(@_) }, "logout", 0);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->useradd(@_) }, "useradd", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->userdel(@_) }, "userdel", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->userset(@_) }, "userset", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->userunset(@_) }, "userunset", 1);
|
||||
$self->{pbot}->{commands}->register(sub { return $self->mycmd(@_) }, "my", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->logincmd(@_) }, "login", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->logoutcmd(@_) }, "logout", 0);
|
||||
$self->{pbot}->{commands}->register(sub { $self->useradd(@_) }, "useradd", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->userdel(@_) }, "userdel", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->userset(@_) }, "userset", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->userunset(@_) }, "userunset", 1);
|
||||
$self->{pbot}->{commands}->register(sub { $self->mycmd(@_) }, "my", 0);
|
||||
|
||||
$self->{pbot}->{capabilities}->add('admin', 'can-useradd', 1);
|
||||
$self->{pbot}->{capabilities}->add('admin', 'can-userdel', 1);
|
||||
|
@ -32,7 +32,7 @@ sub new {
|
||||
|
||||
sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
$self->{pbot} = delete $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||
$self->{pbot} = $conf{pbot} // Carp::croak("Missing pbot reference to " . __FILE__);
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.public', sub { $self->on_public(@_) });
|
||||
$self->{pbot}->{event_dispatcher}->register_handler('irc.caction', sub { $self->on_public(@_) });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user