2021-07-24 02:01:18 +02:00
|
|
|
# File: Handlers.pm
|
|
|
|
#
|
|
|
|
# Purpose: Loads handlers in the Handlers directory.
|
|
|
|
|
|
|
|
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package PBot::Core::Handlers;
|
|
|
|
use parent 'PBot::Core::Class';
|
|
|
|
|
|
|
|
use PBot::Imports;
|
|
|
|
|
2021-07-24 04:22:25 +02:00
|
|
|
use PBot::Core::Utils::LoadModules qw/load_modules/;
|
2021-07-24 02:01:18 +02:00
|
|
|
|
|
|
|
sub initialize {
|
|
|
|
my ($self, %conf) = @_;
|
|
|
|
|
2021-07-24 03:26:45 +02:00
|
|
|
# load the handlers in the Handlers directory
|
|
|
|
$self->load_handlers(%conf);
|
2021-07-24 02:01:18 +02:00
|
|
|
}
|
|
|
|
|
2021-07-24 03:26:45 +02:00
|
|
|
sub load_handlers {
|
2021-07-24 02:01:18 +02:00
|
|
|
my ($self, %conf) = @_;
|
|
|
|
|
2021-07-24 03:26:45 +02:00
|
|
|
$self->{pbot}->{logger}->log("Loading handlers:\n");
|
2021-07-24 02:01:18 +02:00
|
|
|
load_modules($self, 'PBot::Core::Handlers');
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|