mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-26 05:49:27 +01:00
Plugins are now autoloaded via entries listed in the Plugin/autoload file
This commit is contained in:
parent
7506de77bc
commit
4d9b3f09a7
@ -52,7 +52,14 @@ sub autoload {
|
|||||||
$self->{pbot}->{logger}->log("Loading plugins ...\n");
|
$self->{pbot}->{logger}->log("Loading plugins ...\n");
|
||||||
my $plugin_count = 0;
|
my $plugin_count = 0;
|
||||||
|
|
||||||
my @plugins = glob "$path/*.pm";
|
my $fh;
|
||||||
|
if (not open $fh, "<$path/autoload") {
|
||||||
|
$self->{pbot}->{logger}->log("warning: file $path/autoload does not exist; skipping autoloading of Plugins\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chomp(my @plugins = <$fh>);
|
||||||
|
close $fh;
|
||||||
|
|
||||||
foreach my $plugin (sort @plugins) {
|
foreach my $plugin (sort @plugins) {
|
||||||
$plugin = basename $plugin;
|
$plugin = basename $plugin;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
package Plugins::_Example;
|
package Plugins::Example;
|
||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
@ -44,7 +44,7 @@ sub on_public {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{pbot}->{logger}->log("_Example plugin: got message from $nick!$user\@$host: $msg\n");
|
$self->{pbot}->{logger}->log("Example plugin: got message from $nick!$user\@$host: $msg\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -1,8 +1,6 @@
|
|||||||
Loadable plugins live here.
|
Loadable plugins live here.
|
||||||
|
|
||||||
All files not beginning with an underscore will be automatically loaded
|
All files listed in the `autoload` file will be loaded at bot start-up.
|
||||||
at bot start-up.
|
|
||||||
|
|
||||||
Plugins (including those starting with an underscore) can be manually loaded
|
Plugins can be manually loaded or unloaded with the `plug` and `unplug`
|
||||||
or unloaded with the `plug` and `unplug` commands. Use `pluglist` to list
|
commands. Use `pluglist` to list loaded plugins.
|
||||||
loaded plugins.
|
|
||||||
|
11
Plugins/autoload
Normal file
11
Plugins/autoload
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
ActionTrigger.pm
|
||||||
|
AntiAway.pm
|
||||||
|
AntiKickAutoRejoin.pm
|
||||||
|
AntiNickSpam.pm
|
||||||
|
AntiRepeat.pm
|
||||||
|
AntiTwitter.pm
|
||||||
|
AutoRejoin.pm
|
||||||
|
Counter.pm
|
||||||
|
Quotegrabs.pm
|
||||||
|
RemindMe.pm
|
||||||
|
UrlTitles.pm
|
Loading…
Reference in New Issue
Block a user