On Wed, Mar 16, 2016 at 02:44:21AM -0300, pablo báez wrote: > Hi, Hello,
> I'd like to write a plugin for an IRC bot (which is based on > POE::Component::IRC) using POE::Component::IRC::Plugin. I want > it to do the following (this is a simplified version of what I > actually would like it to do): > > When the nick 'foo' sends to a channel > > <foo> !greet 20 > > the bot must reply > > <bot> Hi foo! > > after 20 seconds. How could I do that? I don't know how to > trigger an event after a specified amount of time. I'm a POE newbie myself, but the POE::Kernel SYNOPSIS contains an example that recursively triggers an event after a second (except for the initial one, I imagine): > POE::Session->create( > inline_states => { > _start => sub { $_[KERNEL]->yield("next") }, > next => sub { > print "tick...\n"; > $_[KERNEL]->delay(next => 1); # *** > }, > }); It appears that delay() is a standard method that can trigger an event after some amount of time. Regards, -- Brandon McCaig <bamcc...@gmail.com> <bamb...@castopulence.org> Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
signature.asc
Description: Digital signature