From 5db14568632b4332dff496cf892535dc63d7561b Mon Sep 17 00:00:00 2001 From: Zoffix Znet Date: Sun, 3 Jan 2016 12:08:37 -0500 Subject: Add .notice method --- Changes | 9 ++++++--- README.md | 9 +++++++++ lib/IRC/Client.pm6 | 7 +++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index bb4b730..84771af 100644 --- a/Changes +++ b/Changes @@ -1,10 +1,13 @@ Revision History for 'IRC::Client' Perl 6 Distribution 2.002001 2016-01-03 - - Fix grammar parsing errors that ignored nicks/usernames with underscores + - Fixed grammar parsing errors that ignored nicks/usernames with underscores and digit 0 (#8) - - Add server password support (#3) - - Add `irc-to-me` method + - Added server password support (#3) + [New Events] + - Added `irc-to-me` event + [New Methods] + - Added `notice` event 2.001002 2015-12-30 - Minor doc updates and fixed missing prepreqs in META.info file diff --git a/README.md b/README.md index 69f98cf..9960049 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ IRC::Client - Extendable Internet Relay Chat client - [METHODS FOR PLUGINS](#methods-for-plugins) - [`.ssay`](#ssay) - [`.privmsg`](#privmsg) + - [`.notice`](#notice) - [INCLUDED PLUGINS](#included-plugins) - [IRC::Client::Plugin::Debugger](#ircclientplugindebugger) - [IRC::Client::Plugin::PingPong](#ircclientpluginpingpong) @@ -281,6 +282,14 @@ Sends a message to the server, automatically appending `\r\n`. Mnemonic: Sends a `PRIVMSG` message specified in the second argument to the user/channel specified as the first argument. +## `.notice` + +```perl6 + $irc.notice( 'Zoffix', 'Hallo!' ); +``` +Sends a `NOTICE` message specified in the second argument +to the user/channel specified as the first argument. + # INCLUDED PLUGINS Currently, this distribution comes with two IRC Client plugins: diff --git a/lib/IRC/Client.pm6 b/lib/IRC/Client.pm6 index 6eb610f..cbdb335 100644 --- a/lib/IRC/Client.pm6 +++ b/lib/IRC/Client.pm6 @@ -69,6 +69,13 @@ method privmsg (Str $who, Str $what) { self; } +method notice (Str $who, Str $what) { + my $msg = "NOTICE $who :$what\n"; + $!debug and "{plug-name}$msg".put; + $!sock.print("$msg\n"); + self; +} + method handle-event ($e) { $e = {}; -- cgit v1.1