ajout de mon premier bot IRC, WooT
This commit is contained in:
		
							parent
							
								
									2503200bcd
								
							
						
					
					
						commit
						02a605fde2
					
				
					 1 changed files with 20 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								perl/irc_bot.pl
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								perl/irc_bot.pl
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
use Modern::Perl;
 | 
			
		||||
use AnyEvent;
 | 
			
		||||
use AnyEvent::IRC::Client;
 | 
			
		||||
 | 
			
		||||
my $c = AnyEvent->condvar;
 | 
			
		||||
my $cl = AnyEvent::IRC::Client->new;
 | 
			
		||||
$cl->reg_cb (connect => sub {
 | 
			
		||||
		my ($con, $err) = @_;
 | 
			
		||||
		if (defined $err) {
 | 
			
		||||
			warn "connect error: $err\n";
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
$cl->connect ('irc.geeknode.org', 6667, { nick => '[bot]kanette' });
 | 
			
		||||
$cl->send_srv ( PRIVMSG => 'karchnu', 'Hi there!');
 | 
			
		||||
$c->wait;
 | 
			
		||||
 | 
			
		||||
$cl->disconnect;
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue