|
Revision 53, 0.7 kB
(checked in by bkuhn, 10 months ago)
|
- Added SFLC's internally developed tim bot released under AGPLv3
|
| Line | |
|---|
| 1 |
#!/usr/bin/perl |
|---|
| 2 |
|
|---|
| 3 |
=head1 NAME |
|---|
| 4 |
|
|---|
| 5 |
tango - slap people |
|---|
| 6 |
|
|---|
| 7 |
=head1 USAGE |
|---|
| 8 |
|
|---|
| 9 |
./tango <#channel> [<nick>] |
|---|
| 10 |
|
|---|
| 11 |
Slaps someone in #channel. An option nick is the person to slap, otherwise |
|---|
| 12 |
it'll slap leon. |
|---|
| 13 |
|
|---|
| 14 |
Note that the server is hardcoded. |
|---|
| 15 |
|
|---|
| 16 |
=cut |
|---|
| 17 |
|
|---|
| 18 |
package Bot; |
|---|
| 19 |
use base qw(Bot::BasicBot); |
|---|
| 20 |
use warnings; |
|---|
| 21 |
use strict; |
|---|
| 22 |
|
|---|
| 23 |
my $ticked = 0; |
|---|
| 24 |
|
|---|
| 25 |
sub tick { |
|---|
| 26 |
my $self = shift; |
|---|
| 27 |
exit if $ticked; |
|---|
| 28 |
$self->emote( { channel => ( $self->channels )[0], body => "slaps $self->{slapee}" } ); |
|---|
| 29 |
$ticked = 1; |
|---|
| 30 |
return 1; |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
package main; |
|---|
| 34 |
|
|---|
| 35 |
chomp(my $channel = shift); |
|---|
| 36 |
die "no channel" unless $channel; |
|---|
| 37 |
|
|---|
| 38 |
chomp(my $slapee = shift || "acme"); |
|---|
| 39 |
|
|---|
| 40 |
Bot->new( |
|---|
| 41 |
server => "london.irc.perl.org", |
|---|
| 42 |
channels => [ $channel ], |
|---|
| 43 |
nick => 'tango', |
|---|
| 44 |
slapee => $slapee, |
|---|
| 45 |
)->run(); |
|---|
| 46 |
|
|---|