Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

poe::component::irc::cookbook::basicbot(3pm) [debian man page]

POE::Component::IRC::Cookbook::BasicBot(3pm)		User Contributed Perl Documentation	      POE::Component::IRC::Cookbook::BasicBot(3pm)

NAME
POE::Component::IRC::Cookbook::BasicBot - A basic IRC bot SYNOPSIS
This a very basic bot that connects to IRC, joins a few channels, and announces its arrival. DESCRIPTION
We start off quite simply: #!/usr/bin/env perl use strict; use warnings; Then we "use" the stuff we're going to...well, use. "::State" is a subclass which keeps track of state information related to channels and nicknames. It is needed by the "AutoJoin" plugin which takes care of keeping us on our channels. use POE; use POE::Component::IRC::State; use POE::Component::IRC::Plugin::AutoJoin; Next up is our POE session. We create it and list our event handlers. We then start the POE kernel. POE::Session->create( package_states => [ main => [ qw(_start irc_join) ] ] ); $poe_kernel->run(); Now all we have to do is write the handlers for "_start" and "irc_join". In "_start", we create our IRC component, add an "AutoJoin" plugin, register for the "irc_join" event, and connect to the IRC server. sub _start { my $irc = POE::Component::IRC::State->spawn( Nick => 'basic_bot', Server => 'irc.freenode.net', ); $irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new( Channels => [ '#test_channel1', '#test_channel2' ] )); $irc->yield(register => 'join'); $irc->yield('connect'); } Now comes our "irc_join" event handler. We send a message to the channel once we've joined it. 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 everybody!'); } } That's it! AUTHOR
Hinrik Oern Sigur`sson, hinrik.sig@gmail.com perl v5.14.2 2011-12-07 POE::Component::IRC::Cookbook::BasicBot(3pm)

Check Out this Related Man Page

POE::Component::IRC::Plugin::NickServID(3pm)		User Contributed Perl Documentation	      POE::Component::IRC::Plugin::NickServID(3pm)

NAME
POE::Component::IRC::Plugin::NickServID - A PoCo-IRC plugin which identifies with NickServ when needed SYNOPSIS
use POE::Component::IRC::Plugin::NickServID; $irc->plugin_add( 'NickServID', POE::Component::IRC::Plugin::NickServID->new( Password => 'opensesame' )); DESCRIPTION
POE::Component::IRC::Plugin::NickServID is a POE::Component::IRC plugin. It identifies with NickServ on connect and when you change your nick, if your nickname matches the supplied password. Note: If you have a cloak and you don't want to be seen without it, make sure you don't join channels until after you've identified yourself. If you use the AutoJoin plugin, it will be taken care of for you. METHODS
"new" Arguments: 'Password', the NickServ password. Returns a plugin object suitable for feeding to POE::Component::IRC's plugin_add() method. OUTPUT EVENTS
"irc_identified" This event will be sent when you have identified with NickServ. No arguments are passed with it. AUTHOR
Hinrik Oern Sigur`sson, hinrik.sig@gmail.com perl v5.14.2 2011-12-07 POE::Component::IRC::Plugin::NickServID(3pm)
Man Page

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Bots

Hi i just joined i was wanting to know if anyone knew a good program or something to help me create a bot? (1 Reply)
Discussion started by: Bigin
1 Replies

2. UNIX for Dummies Questions & Answers

Where is Mozilla IRC Client on SuSE?

I have grown to love the IRC client built into the windows version of the Mozilla web browser. I bring up the browser and put irc:// into the URL drop down box and the IRC client pops up in a seperate window. However, when I use the Mozilla browser in SuSE 10, it just says "illegal protocol" or... (1 Reply)
Discussion started by: siegfried
1 Replies

3. Shell Programming and Scripting

How to setup a shell to use IRC behind firewall help

So, I have a free shell from an online provider which offer IRC access, I am behind a firewall blocking all IRC ports @ work, how can I use the Shell to get on IRC from work? What do I need to setup on the shell to be able to connect to the shell on the ssh port which allows connections from work,... (10 Replies)
Discussion started by: KromiX
10 Replies

4. Programming

Microline Component ToolKit equivalent

Hello, MCT(Microline Component Toolkit) is a thirdparty product used to display widgets like GRIDs, buttons etc.. using Java. If you have more details about the product and please send the references. Let me know the equivalent software avaialble in todays Java world. Thanks, Shafi (1 Reply)
Discussion started by: shafi2all
1 Replies

5. Shell Programming and Scripting

How do I run a shell command in a while loop?

The command is: sic -h irc.freenode.net 2>&1 | tee -a irc.log Where sic is an IRC client, and I'm piping the output to tee in order to log my IRC sessions. I'm trying to handle reconnects by running it in a while loop in the shell process and cat the initial commands into sic's stdin. I... (1 Reply)
Discussion started by: guitarscn
1 Replies

6. Shell Programming and Scripting

Using ii for irc chat - scripting assistance?

I am using ii for irc on my pogoplug... hxxp://hg.suckless.org/ii/file/d163c8917af7/FAQ If you look at the bottom of there, it states 31 What other fancy stuff can I do with ii? 32 ---------------------------------------- 33 It is very easy to write irc bots in ii: 34... (3 Replies)
Discussion started by: spartan2006
3 Replies

7. UNIX for Dummies Questions & Answers

How does IRC obtain the users in a channel?

I'm on an IRC server where the command /names is not a valid command. However, on programs like mIRC and Mibbit, the users in the channel still show up on the GUI where it displays the channel users. What command is being used to obtain the user list? (2 Replies)
Discussion started by: daigo
2 Replies

8. UNIX for Beginners Questions & Answers

IRC, DCC send and DCC get.

I'm not sure if this is the "appropriate" place to be asking a question like this. So, here goes. I'm having problems with IRC (ircII is my client). DCC sends and DCC gets specifically. It seems like I can only successfully get and send from my local machine. I've played around with UFW (Firewall... (2 Replies)
Discussion started by: ignatius
2 Replies