3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

PBot can now be started from any location, even symlinks

This commit is contained in:
Pragmatic Software 2019-12-19 23:29:56 -08:00
parent 82d29fa058
commit 94eba5f161

15
pbot.pl
View File

@ -10,15 +10,17 @@
# 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/.
my $VERSION = "1.0.0";
use feature 'unicode_strings';
use strict;
use warnings;
use lib ".";
use PBot::PBot;
my $bothome;
BEGIN {
use File::Basename;
$bothome = -l __FILE__ ? dirname readlink __FILE__ : dirname __FILE__;
unshift @INC, $bothome;
}
# !! NOTICE !!
#
@ -31,10 +33,6 @@ use PBot::PBot;
#
# !! NOTICE !!
# Be sure to set $bothome to the location PBot was extracted (default assumes ~/pbot).
# This location must contain the PBot directory, among others configured below.
my $bothome = "$ENV{HOME}/pbot";
my %config = (
# -----------------------------------------------------
# Be sure to set your IRC information to a registered NickServ account
@ -134,6 +132,7 @@ $config{quotegrabs_file} = "$config{data_dir}/quotegrabs.sqlite3";
$config{message_history_file} = "$config{data_dir}/message_history.sqlite3";
# Create and initialize bot object
use PBot::PBot;
my $pbot = PBot::PBot->new(%config);
# Start the bot main loop; doesn't return