Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use POE;
- use POE::Component::IRC::State;
- use POE::Component::IRC::Plugin::AutoJoin;
- use POE::Component::IRC::Plugin::NickServID;
- use POE::Component::IRC::Plugin::Logger;
- POE::Session->create(
- package_states => [
- main => [ qw(_start irc_join) ]
- ]
- );
- $poe_kernel->run();
- sub _start {
- my $irc = POE::Component::IRC::State->spawn(
- Nick => 'taylah',
- Ircname => 'taylah',
- Username => 'taylah',
- Server => 'irc.freenode.net',
- );
- $irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new(
- Channels => [ '#channel', ]
- ));
- $irc->plugin_add( 'taylah', POE::Component::IRC::Plugin::NickServID->new(
- Password => 'password'
- ));
- $irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->new(
- Path => '/home/stuff/',
- DCC => 0,
- Private => 0,
- Public => 1,
- Sort_by_date => '#channel-DD-MM-YYYY.log',
- ));
- $irc->yield(register => 'join');
- $irc->yield('connect');
- }
- sub irc_join {
- my $nick = (split /!/, $_[ARG0])[0];
- my $channel = $_[ARG1];
- my $irc = $_[SENDER]->get_heap();
- # only send the message if we were the one joining
- if ($nick eq $irc->nick_name()) {
- $irc->yield(privmsg => $channel, 'hi');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement