Leser: 2
9 Einträge, 1 Seite |
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -w
use Net::IRC;
use strict;
use warnings;
use threads;
my $irc = new Net::IRC;
my $conn = $irc->newconn(
Server => 'de.quakenet.org',
Port => '6667',
Nick => 'HelloBot007',
Ircname => 'Bot007!',
Username => 'hello'
);
$conn->{channel} = '#testor55';
sub on_connect {
my $conn = shift;
$conn->join($conn->{channel});
$conn->privmsg($conn->{channel}, 'Hello everyone!');
$conn->{connected} = 1;
}
sub on_join {
my ($conn, $event) = @_;
my $nick = $event->{nick};
$conn->privmsg($conn->{channel}, "Hello, $nick!");
}
sub on_part {
my ($conn, $event) = @_;
my $nick = $event->{nick};
$conn->privmsg($conn->{channel}, "Goodbye, $nick!");
}
$conn->add_handler('join', \&on_join);
$conn->add_handler('part', \&on_part);
$conn->add_handler('376', \&on_connect);
my $web_start = threads->create('start_web');
$web_start->join();
my $irc_start = threads->create('start_irc');
$irc_start->join();
sub start_web { while (1) {print "hallo\n"; sleep 10;}}
sub start_irc { $irc->start(); }
print "hallo\n";
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";
9 Einträge, 1 Seite |