aboutsummaryrefslogtreecommitdiff
path: root/sb_config.pm
diff options
context:
space:
mode:
Diffstat (limited to 'sb_config.pm')
-rw-r--r--sb_config.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/sb_config.pm b/sb_config.pm
index 5440f0c..dcff683 100644
--- a/sb_config.pm
+++ b/sb_config.pm
@@ -9,7 +9,7 @@ use Config::Tiny;
sub parse_config
{
my @scalar_configs = ('nick', 'username', 'ircname', 'server', 'port', 'password', 'must_id');
- my @list_configs = ('channels', 'ignore', 'admins', 'triggers');
+ my @list_configs = ('channels', 'ignore', 'admins');
my $file = $_[0];
my %built_config;
my $config = Config::Tiny->read($file);
@@ -25,6 +25,18 @@ sub parse_config
@built_config{$option} = [split /\s*,\s*/, $vals];
}
+ # special case: triggers hash
+ my %triggers;
+ foreach (split ',', $config->{_}->{triggers}) {
+ my ($match, $response) = split /=>/;
+ # strip outer quotes
+ $match =~ s/^[^']*'|'[^']*$//g;
+ $response =~ s/^[^']*'|'[^']*$//g;
+ $triggers{$match} = $response;
+ }
+
+ $built_config{triggers} = \%triggers;
+
return %built_config;
}
1;