From 0c7cd1b9186cb8d891bde276e1da895cc46003c8 Mon Sep 17 00:00:00 2001 From: Mallory Hancock Date: Tue, 10 Oct 2017 08:56:41 -0700 Subject: [PATCH] update tutorial --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d041e87..baeee8a 100644 --- a/README.md +++ b/README.md @@ -38,18 +38,20 @@ The function will need to be structured as such: import pinhook.plugin @pinhook.plugin.register('!test') -def test_plugin(**kwargs): - nick = kwargs['nick'] - message = '{}: this is a test!'.format(nick) +def test_plugin(msg): + message = '{}: this is a test!'.format(msg.nick) return pinhook.plugin.message(message) ``` -The function will need to accept `**kwargs` in order to gather information from the bot. +The function will need to accept a single argument in order to accept a `Message` object from the bot. -Keyword arguments currently passed to the plugin: +The `Message` object has the following attributes: * `cmd`: the command that triggered the function * `nick`: the user who triggered the command * `arg`: all the trailing text after the command. This is what you will use to get optional information for the command +* `channel`: the channel where the command was initiated +* `ops`: the list of bot operators +* `botnick`: the nickname of the bot The plugin function **must** return one of the following in order to give a response to the command: * `pinhook.plugin.message`: basic message in channel where command was triggered