-
Notifications
You must be signed in to change notification settings - Fork 12
/
infobot
executable file
·104 lines (74 loc) · 2.2 KB
/
infobot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/perl
# infobot -- copyright kevin lenzo (c) 1997-infinity
# Flooterbuck Infobot -- copyright (C) Dave Brown, 2001-2004
# For full licensing terms see the file LICENSE included with
# the flooterbuck distribution.
require 5.6.0;
BEGIN {
$VER_MAJ = 1;
$VER_MIN = 2;
$VER_MOD = 1;
$version = "Flooterbuck infobot $VER_MAJ\.$VER_MIN\.$VER_MOD [dagbrown]";
}
BEGIN {
$filesep = '/';
# set this to the absolute path if you need it; especially
# if . is not in your path
$param{'basedir'} = ( $0 =~ /(.*)$filesep/ ) ? $1 : '.';
# $infobot_base_dir = '/usr/local/lib/infobot';
# change this next line if you run a local instance of
# an infobot and use the code from the main location.
# the 'files' directory contains infobot.config and
# infobot.users, among other things.
$param{'confdir'} = "$param{basedir}${filesep}conf";
# everything is loaded, then the variables that
# you want to set will override the defaults; this
# is why all these requires are here.
$param{'srcdir'} = $param{'basedir'} . $filesep . "src";
opendir DIR, $param{'srcdir'}
or die "can't open source directory $param{srcdir}: $!";
while ( $file = readdir DIR ) {
next unless $file =~ /\.pl$/;
require "$param{srcdir}$filesep$file";
}
closedir DIR;
}
# get the command line arguments
&getArgs();
# initialize everything
&setup();
# launch the irc event loop
&irc();
exit 0; # just so you don't look farther down in this file :)
# --- support routines
sub usage {
print "\n";
print " usage: $0 [-h] [<config file>]\n";
print "\n";
print " -h this message\n";
print "\n";
}
sub getArgs {
if ( $ARGV[0] ) {
if ( $ARGV[0] =~ /^-[hi\?]/ ) {
&usage;
exit 1;
}
else {
$paramfile = $ARGV[0];
}
}
else {
$paramfile = '';
}
}
1;
__END__
=head1 NAME
Flooterbuck Infobot - a modular IRC information bot
=head1 SYNOPSIS
B<infobot> S<[ -h ]> [I<paramfile1> [I<paramfile2> ...]]
=head1 NOTE
If you're reading this, you need to yell at
Dave Brown ([email protected])
and tell him to write some actual documentation. =)