Advertisement
Guest User

Untitled

a guest
Aug 5th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use POE;
  7. use POE::Component::IRC::State;
  8. use POE::Component::IRC::Plugin::AutoJoin;
  9. use POE::Component::IRC::Plugin::NickServID;
  10. use POE::Component::IRC::Plugin::Logger;
  11.  
  12.  
  13.  
  14. POE::Session->create(
  15. package_states => [
  16. main => [ qw(_start irc_join) ]
  17. ]
  18. );
  19.  
  20. $poe_kernel->run();
  21.  
  22. sub _start {
  23. my $irc = POE::Component::IRC::State->spawn(
  24. Nick => 'taylah',
  25. Ircname => 'taylah',
  26. Username => 'taylah',
  27. Server => 'irc.freenode.net',
  28. );
  29.  
  30. $irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new(
  31. Channels => [ '#channel', ]
  32. ));
  33.  
  34. $irc->plugin_add( 'taylah', POE::Component::IRC::Plugin::NickServID->new(
  35. Password => 'password'
  36. ));
  37.  
  38. $irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->new(
  39. Path => '/home/stuff/',
  40. DCC => 0,
  41. Private => 0,
  42. Public => 1,
  43. Sort_by_date => '#channel-DD-MM-YYYY.log',
  44. ));
  45.  
  46. $irc->yield(register => 'join');
  47. $irc->yield('connect');
  48. }
  49.  
  50. sub irc_join {
  51. my $nick = (split /!/, $_[ARG0])[0];
  52. my $channel = $_[ARG1];
  53. my $irc = $_[SENDER]->get_heap();
  54.  
  55. # only send the message if we were the one joining
  56. if ($nick eq $irc->nick_name()) {
  57. $irc->yield(privmsg => $channel, 'hi');
  58.  
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement