Thread IRC Bot Problem
(8 answers)
Opened by Gast at 2008-05-17 15:09
Bin selber gerade dabei einen IRC-Bot zuproggen.
Vielleicht hilft dir dieser "kleine" Codeausschnitt weiter. Das ist der Verbinungsaufbau zum IRC + das joinen eines channels. Wenn du Probleme mit einem Pingtimeout vom IRC Server bekommst einfach nachfragen. Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 use IO::Socket::INET; $server = "irc.seilen.de"; $port = "6667"; $channel = "#bot"; $nick = "tK-Bot"; my $sock = new IO::Socket::INET( PeerAddr => $server, PeerPort => $port, Proto => 'tcp', ) || die "No connection $!\n"; print $sock "NICK $nickf\r\n"; print $sock "USER lol\r\n"; while ($input = <$sock>) { if ($input =~ /004/) { last; } elsif ($input =~ /433/) { print $sock "NICK Anderer-Nick\r\n"; } } print $sock "JOIN $channel\r\n"; print $sock "PRIVMSG $channel :\001ACTION HELLO WORLD \001\r\n"; MFG Monk |