-
Notifications
You must be signed in to change notification settings - Fork 1
/
taeja.pl
executable file
·54 lines (41 loc) · 1.24 KB
/
taeja.pl
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
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
binmode STDOUT, ":utf8";
use Config::Tiny;
use Bot::TaeJa;
use Command::Help;
use Command::Info;
use Command::Say;
use Command::Hook;
use Command::Player;
use Command::Clan;
use Command::Export;
use Command::Bounds;
use Data::Dumper;
# Fallback to "config.ini" if the user does not pass in a config file.
my $config_file = $ARGV[0] // 'config.ini';
my $config = Config::Tiny->read($config_file, 'utf8');
say localtime(time) . " Loaded Config: $config_file";
my %config = %{$config};
foreach my $label (keys %config) {
foreach my $key (keys %{$config{$label}}) {
$config{$label}->{$key} =~ s/"//g;
}
}
my $self = {}; # For miscellaneous information about this bot such as discord id
# Initialize the bot
my $bot = Bot::TaeJa->new(%{$config});
# Register the commands
# The new() function in each command will register with the bot.
Command::Help->new ('bot' => $bot);
Command::Info->new ('bot' => $bot);
Command::Say->new ('bot' => $bot);
Command::Hook->new ('bot' => $bot);
Command::Player->new ('bot' => $bot);
Command::Clan->new ('bot' => $bot);
Command::Export->new ('bot' => $bot);
Command::Bounds->new ('bot' => $bot);
# Start the bot
$bot->start();