From 7754a0b4b5b25cfc2d6faeb330cead16eb779fc7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Thu, 4 Dec 2014 13:06:56 +0100 Subject: Updated bot configuration --- .gitignore | 1 + Avalon.pm | 10 ++++++++++ arthur.cfg.example | 4 +++- arthur.pl | 7 ++----- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 38b9ef8..1034fa6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.swp arthur.cfg +Session.vim diff --git a/Avalon.pm b/Avalon.pm index 3bf30b2..6940c01 100644 --- a/Avalon.pm +++ b/Avalon.pm @@ -1,4 +1,7 @@ package Bot::BasicBot::Pluggable::Module::Avalon; +{ + $Avalon::Arthur::VERSION = '0.01'; +}; use strict; use warnings; @@ -7,12 +10,19 @@ use experimental qw(switch); use base qw(Bot::BasicBot::Pluggable::Module); +sub init { + my $self = shift; + $self->{avalon} = {}; + $self->{avalon}->{config} = $self->bot->{store_object}->{store}->{cfg}->{cfg}; +} + sub help { return "The avalon game simulator : https://github.com/adyxax/avalon-arthur"; } sub told { my ( $self, $mess ) = @_; + my $who = $mess->{who}; my $body = $mess->{body}; my $ispriv = defined $mess->{address}; diff --git a/arthur.cfg.example b/arthur.cfg.example index ad80555..d31813e 100644 --- a/arthur.cfg.example +++ b/arthur.cfg.example @@ -7,5 +7,7 @@ ircname = Arthur the Avalon Game Master server = example.org port = 6667 password = -channel = "#avalon" ssl = 1 + +[game] +channel = "#avalon" diff --git a/arthur.pl b/arthur.pl index f2d0ec1..b1c29f7 100755 --- a/arthur.pl +++ b/arthur.pl @@ -4,9 +4,6 @@ use warnings; use strict; package Avalon::Arthur; -{ - $Avalon::Arthur::VERSION = '0.01'; -} use Bot::BasicBot::Pluggable; use Config::Simple; @@ -21,10 +18,10 @@ my $bot = Bot::BasicBot::Pluggable->new( port => $cfg{'irc.port'}, password => $cfg{'irc.password'}, ssl => $cfg{'irc.ssl'}, - channels => ($cfg{'irc.channel'}), + channels => ($cfg{'game.channel'}), store => Bot::BasicBot::Pluggable::Store->new(), ); -$bot->{cfg} = \%cfg; +$bot->{store_object}->{store}->{cfg}->{cfg} = \%cfg; $bot->load("Auth"); $bot->{store_object}->{store}->{Auth}->{password_admin} = $cfg{'admin.password'}; -- cgit v1.2.3