Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • b4f1a35663b8b392016690adfa59e55ab15f6d3c
  • master par défaut
  • cinch
  • ruby
  • gh-pages
  • v1.0.0
6 résultats

PlayBot.pl

Blame
  • PlayBot.pl 8,24 Kio
    #!/usr/bin/perl -w
    use strict;
    use warnings;
    use POE;
    use POE::Component::IRC;
    use POSIX 'strftime';
    use DBI;
    use Tie::File;
    
    use Logging;
    use youtube;
    use soundcloud;
    use mixcloud;
    use zippy;
    
    
    # nom du fichier
    my $bot = $0;
    
    my $log = Logging->new('STDOUT', 1);
    
    # config
    my $serveur = 'IRC.iiens.net';
    my $nick = 'PlayBot';
    my $port = 6667;
    my $ircname = 'nightiies';
    my $username = 'nightiies';
    my @channels = qw(#nightiies #bigphatsubwoofer);
    my $admin = 'moise';
    my $baseurl = 'http://nightiies.iiens.net/links/';
    my @nicksToVerify;
    my @codesToVerify;
    my $lastID;
    
    my $debug = 0;
    
    # mode debug
    if ($#ARGV + 1) {
    	@channels = qw(#hormone);
    	$nick = 'kikoo';
    	$debug = 1;
    }
    
    
    ## CONNEXION 
    my ($irc) = POE::Component::IRC->spawn();
    my $dbh = DBI->connect('DBI:mysql:assoce_nightiies;host=mysql.iiens.net', 'assoce_nightiies', 'POiREAU.jKNCFfBRq', {
    	        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_notice => \&on_notice,
    		_flux	   => \&flux,
    		_later     => \&later
    	},
    );
    
    
    my %commandes_admin = ("cycle" => \&cycle);