From f5d28c34ffc14045bc49cd3cb22af108d23886bd Mon Sep 17 00:00:00 2001 From: Zoffix Znet Date: Sun, 3 Jan 2016 12:37:27 -0500 Subject: Add .respond method --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 11 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9960049..8e27d8f 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ IRC::Client - Extendable Internet Relay Chat client - [`plugins-essential`](#plugins-essential) - [`run`](#run) - [METHODS FOR PLUGINS](#methods-for-plugins) - - [`.ssay`](#ssay) - - [`.privmsg`](#privmsg) - [`.notice`](#notice) + - [`.privmsg`](#privmsg) + - [`.respond`](#respond) + - [`.ssay`](#ssay) - [INCLUDED PLUGINS](#included-plugins) - [IRC::Client::Plugin::Debugger](#ircclientplugindebugger) - [IRC::Client::Plugin::PingPong](#ircclientpluginpingpong) @@ -265,14 +266,13 @@ to the IRC server ends. You can make use of these `IRC::Client` methods in your plugins: -## `.ssay` +## `.notice` ```perl6 - $irc.ssay("Foo bar!"); + $irc.notice( 'Zoffix', 'Hallo!' ); ``` -Sends a message to the server, automatically appending `\r\n`. Mnemonic: -**s**erver **say**. - +Sends a `NOTICE` message specified in the second argument +to the user/channel specified as the first argument. ## `.privmsg` @@ -282,13 +282,61 @@ 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` +## `.respond` ```perl6 - $irc.notice( 'Zoffix', 'Hallo!' ); + $irc.respond: + :where<#zofbot> + :what('Hallo how are you?!') + :how + :who + ; ``` -Sends a `NOTICE` message specified in the second argument -to the user/channel specified as the first argument. +Generates a response based on the provided arguments, which are as follows: + +### `where` + +```perl6 + $irc.respond: :where ... + $irc.respond: :where<#zofbot> ... +``` +**Mandatory**. Takes either a nickname or a channel name where to +send the message to. + +### `what` + +```perl6 + $irc.respond: :what('Hallo how are you?!') ... +``` +**Mandatory**. Takes a string, which is the message to be sent. + +### `how` + +```perl6 + $irc.respond: :how ... + $irc.respond: :how ... +``` +**Optional**. Specifies whether the message should be sent using +`PRIVMSG` or `NOTICE` IRC commands. **Valid values** are `privmsg` and `notice` +(case-insensitive). + +### `who` + +```perl6 + $irc.respond: :who ... +``` +**Optional**. Takes a string with a nickname (which doesn't need to be +valid in any way). If the `where` argument is set to a name of a channel, +then the method will modify the `what` argument, by prepending +`$who, ` to it. + +## `.ssay` + +```perl6 + $irc.ssay("Foo bar!"); +``` +Sends a message to the server, automatically appending `\r\n`. Mnemonic: +**s**erver **say**. # INCLUDED PLUGINS -- cgit v1.1