diff --git a/PlayBot.pl b/PlayBot.pl index 4ce7ec4e193f1a99ebbe8bfdba07f8faff3be0ab..c3d4374d032d5018f7e9bbe976db269acba307e8 100755 --- a/PlayBot.pl +++ b/PlayBot.pl @@ -6,6 +6,7 @@ use POE::Component::IRC; use POSIX 'strftime'; use DBI; use Tie::File; +use JSON; use Logging; use youtube; @@ -42,9 +43,15 @@ if ($#ARGV + 1) { } +local $/; +open CONF, '<', 'playbot.conf'; +my $json = <CONF>; +my $conf = decode_json($json); + + ## CONNEXION my ($irc) = POE::Component::IRC->spawn(); -my $dbh = DBI->connect('DBI:mysql:assoce_nightiies;host=mysql.iiens.net', 'assoce_nightiies', 'POiREAU.jKNCFfBRq', { +my $dbh = DBI->connect('DBI:mysql:'.$conf->{'bdd'}.';host='.$conf->{'host'}, $conf->{'user'}, $conf->{'passwd'}, { PrintError => 0, AutoCommit => 1, mysql_auto_reconnect => 1