Sélectionner une révision Git
-
Kubat a rédigé
The obfuscation download mode can't change for the moment. It would require to 'translate' filepaths, or be able to deal with non uniform databases, don't do that for the moment. Also update the changelog.
Kubat a rédigéThe obfuscation download mode can't change for the moment. It would require to 'translate' filepaths, or be able to deal with non uniform databases, don't do that for the moment. Also update the changelog.
Sam.pm 3,06 Kio
package Sam;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(start);
use strict;
use warnings;
use POE;
use POE::Component::IRC;
use DBI;
use JSON;
use Logging;
use commands::parser;
my $log = Logging->new('STDOUT', 1);
# config
my $serveur = 'IRC.iiens.net';
my $nick = 'Sam';
my $port = 6667;
my $ircname = 'nightiies';
my $username = 'nightiies';
my @channels = qw(#nightiies #bigphatsubwoofer);
my $admin = 'moise';
my $baseurl = 'http://nightiies.iiens.net/sam/';
my %lastID;
my %commandes_admin = ("cycle" => \&cycle);
my $debug = 0;
# mode debug
if ($#ARGV + 1) {
@channels = qw(#hormone);
$nick = 'glloq';
$debug = 1;
}
local $/;
open CONF, '<', 'sam.conf';
my $json = <CONF>;
my $conf = decode_json($json);
my ($irc) = POE::Component::IRC->spawn();
my $dbh = DBI->connect('DBI:mysql:'.$conf->{'bdd'}.';host='.$conf->{'host'}, $conf->{'user'}, $conf->{'passwd'}, {
PrintError => 0,
AutoCommit => 1,
mysql_auto_reconnect => 1
})
or die("Couldn't connect to database: ".DBI->errstr);
# Evenements que le bot va gérer
POE::Session->create(
inline_states => {
_start => \&bot_start,
irc_001 => \&on_connect,
irc_public => \&on_speak,
irc_msg => \&on_query,
irc_invite => \&on_invite
},
);
sub cycle
{
my ($arg) = @_;