From 99eee13297570f3cf2897183e7d1c8f51276c61a Mon Sep 17 00:00:00 2001 From: Zoffix Znet Date: Fri, 29 Jul 2016 10:09:04 -0400 Subject: Moar docs --- README.md | 8 ++++---- docs/01-basics.md | 6 +++--- docs/02-event-reference.md | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e0b0940..7291c16 100644 --- a/README.md +++ b/README.md @@ -14,15 +14,15 @@ IRC::Client - Extendable Internet Relay Chat client :host :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 :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 :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. -- cgit v1.1