POE::Component::IRC::Plugin::Infobot - Add infobot features to an PoCo-IRC
use POE::Component::IRC::Plugin::Infobot; $irc->plugin_add(Infobot => POE::Component::Plugin::Infobot->new(filename => '/tmp/stuff.db'))
POE::Component::IRC::Plugin::Infobot is a PoCo-IRC plugin that makes a PoCo-IRC behave like a simple infobot.
It stores factoids in a DB_File database and lets IRC users add, remove and retreive factoids.
The constructor takes one optional argument, filename, the path to the factoids database. It is 'factoids.db' by default.
Any message of the form "X is Y" which is addressed to the bot or sent in private is an add command. This will not overwrite a previous factoid with the same key.
< mgv> bot: IRC is Internet Relay Chat <+bot> OK, mgv < mgv> bot: IRC is Internet Relay Chat <+bot> I already had it that way, mgv < mgv> bot: IRC is Internally-Routed Communication <+bot> ... but IRC is Internet Relay Chat! < mgv> bot: x is <reply> y! <+bot> sure, mgv < mgv> bot: whistle is <action> whistles <+bot>
Any message of the form "forget X" which is addressed to the bot or sent in private is a forget command. This command will erase any previous factoid with this key.
< mgv> bot: forget IRC <+bot> mgv: I forgot IRC < mgv> bot: forget IRC <+bot> I didn't have anything matching IRC, mgv
Any message ending in a question mark is a query command. If a factoid with that key is found, the plugin will respond. If no such factoid is found AND the message is either addressed to the bot or sent in private, the bot will say that it doesn't know the answer to the question.
If the factoid starts with
<reply>, everything after the
<reply> is sent. If it starts with
<action>, it is sent as a CTCP ACTION. Otherwise, a message of the form
factoid_key is factoid_value is sent.
< mgv> IRC? <+bot> methinks IRC is Internet Relay Chat < mgv> ASD? < mgv> bot: ASD? <+bot> Dunno, mgv < mgv> x? <+bot> y! < mgv> whistle? * bot whistles
Marius Gavrilescu, <email@example.com>
Copyright (C) 2013-2015 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.