From e3c619494601a8628b8a27bd855fa9b1506c0728 Mon Sep 17 00:00:00 2001 From: Zoffix Znet Date: Fri, 29 Jul 2016 19:21:20 -0400 Subject: Add examples; fix up docs --- examples/02-trickster-bot.p6 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/02-trickster-bot.p6 (limited to 'examples/02-trickster-bot.p6') diff --git a/examples/02-trickster-bot.p6 b/examples/02-trickster-bot.p6 new file mode 100644 index 0000000..178fcdd --- /dev/null +++ b/examples/02-trickster-bot.p6 @@ -0,0 +1,19 @@ +use lib ; + +use IRC::Client; +class Trickster { + multi method irc-to-me ($ where /time/) { DateTime.now } + multi method irc-to-me ($ where /temp \s+ $=\d+ $=[F|C]/) { + $ eq 'F' ?? "That's {($ - 32) × .5556}°C" + !! "That's { $ × 1.8 + 32 }°F" + } +} + +class BFF { method irc-to-me ($ where /'♥'/) { 'I ♥ YOU!' } } + +.run with IRC::Client.new: + :nick + :host + :channels<#zofbot> + :debug + :plugins(Trickster, BFF) -- cgit v1.1