3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00
pbot/pbot.pl
Pragmatic Software 0e0f64531b Simplify pbot.pl and refactor PBot.pm.
Command-line arguments can override registry entries.
Remove config_dir. Use data_dir instead.
2019-12-21 19:04:39 -08:00

59 lines
1.8 KiB
Perl
Executable File

#!/usr/bin/env perl
#
# File: pbot.pl
# Author: pragma_
#
# Purpose: IRC Bot (3rd generation)
########################
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
use feature 'unicode_strings';
use strict;
use warnings;
my $bothome;
BEGIN {
use File::Basename;
$bothome = -l __FILE__ ? dirname readlink __FILE__ : dirname __FILE__;
unshift @INC, $bothome;
}
my %config = (
# Path to data directory
data_dir => "$bothome/data",
# Path to directory containing command-line modules
module_dir => "$bothome/modules",
# Path to directory containing loadable plugins
plugin_dir => "$bothome/Plugins",
# Path to log file
log_file => "$bothome/log/log",
# -----------------------------------------------------
# The bot can export the latest factoids and quotegrabs to an HTML
# document. If you run a webserver or something similiar, you may
# wish to set the following items ending with 'path' to point to
# a suitable location for the webserver, and to set the items
# ending with 'site' to the public-facing URL where the files
# may be viewed in a browser.
# -----------------------------------------------------
export_factoids_path => "$bothome/factoids.html", # change to a path in your webroot
export_factoids_site => 'http://your.website.com/factoids.html',
export_quotegrabs_path => "$bothome/quotegrabs.html", # change to a path in your webroot
export_quotegrabs_site => 'http://your.website.com/quotegrabs.html',
);
# Create and initialize bot object
use PBot::PBot;
my $pbot = PBot::PBot->new(%config);
# Start the bot main loop; doesn't return
$pbot->start();