update tutorial
parent
cc17b9ae72
commit
0c7cd1b918
12
README.md
12
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
|
||||
|
|
Loading…
Reference in New Issue