diff options
author | Zoffix Znet <cpan@zoffix.com> | 2016-07-29 10:09:04 -0400 |
---|---|---|
committer | Zoffix Znet <cpan@zoffix.com> | 2016-07-29 10:09:04 -0400 |
commit | 99eee13297570f3cf2897183e7d1c8f51276c61a (patch) | |
tree | 4728757d35cd2e87aefcba57ae64aca09f27d5e1 | |
parent | 582354a484e67a9bbbf4271622e13d22eca89853 (diff) |
Moar docs
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | docs/01-basics.md | 6 | ||||
-rw-r--r-- | docs/02-event-reference.md | 35 |
3 files changed, 42 insertions, 7 deletions
@@ -14,15 +14,15 @@ IRC::Client - Extendable Internet Relay Chat client :host<irc.freenode.net> :channels<#perl6bot #zofbot> :debug - :plugins[ + :plugins( class { method irc-to-me ($ where /hello/) { 'Hello to you too!'} } - ] - :filters[ + ) + :filters( -> $text where .chars > 200 { 'The output is too large to show here. See: ' ~ Pastebin::Shadowcat.new.paste: $text; } - ]; + ); ``` # DESCRIPTION diff --git a/docs/01-basics.md b/docs/01-basics.md index c43fd49..36ae32f 100644 --- a/docs/01-basics.md +++ b/docs/01-basics.md @@ -88,9 +88,9 @@ the original message, prefixed with `You said `. :host<irc.freenode.net> :channels<#perl6bot #zofbot> :debug - :plugins[ + :plugins( class { method irc-to-me ($e) { "You said $e.text()"} } - ] + ) ``` ## Generating Messages @@ -118,7 +118,7 @@ class AlarmBot does IRC::Client::Plugin { :host<irc.freenode.net> :channels<#perl6> :debug - :plugins[AlarmBot.new] + :plugins(AlarmBot.new) ``` Here, we subscribe to `irc-connected` event (using an anonymous parameter diff --git a/docs/02-event-reference.md b/docs/02-event-reference.md index d990307..a091c78 100644 --- a/docs/02-event-reference.md +++ b/docs/02-event-reference.md @@ -67,6 +67,41 @@ been fully established yet or channels joined yet. the plugins * This event does not trigger `irc-all` event +## Event Triggers + +### `irc-addressed` + +``` +irc-addressed ▶ irc-to-me ▶ irc-privmsg-channel ▶ irc-privmsg ▶ irc-all +irc-addressed ▶ irc-to-me ▶ irc-notice-channel ▶ irc-notice ▶ irc-all +``` + +This event chain is triggered when the client is addressed in channel either +via a `PRIVMSG` or `NOTICE` IRC message. 'Addressed' means the message line +starts with the current nickname of the client, followed by single whitespace character, `;`, or `,` characters, followed by any number of whitespace; or +in regex terms, matches `/^ $nick <[,:\s]> \s* /`. This prefix portion will be +**stripped** from the actual message. + +Possible message objects received by event handler: + +``` +IRC::Client::Message::Privmsg::Channel +IRC::Client::Message::Notice::Channel +``` + +### `irc-mentioned` + +``` +irc-mentioned ▶ irc-privmsg-channel ▶ irc-privmsg ▶ irc-all +irc-mentioned ▶ irc-notice-channel ▶ irc-notice ▶ irc-all +``` + +Possible message objects received by event handler: +``` +IRC::Client::Message::Privmsg::Channel +IRC::Client::Message::Notice::Channel +``` + ## Up Next Read [the method reference](03-method-reference.md) next. |