update documentation
parent
afb9cc7f12
commit
708d5146e8
27
README.md
27
README.md
|
@ -7,7 +7,7 @@ a pluggable irc bot framework in python
|
|||
$ pip install pinhook
|
||||
```
|
||||
|
||||
### Creating the Bot
|
||||
### Creating an IRC Bot
|
||||
To create the bot, just create a python file with the following:
|
||||
|
||||
```python
|
||||
|
@ -28,6 +28,31 @@ Optional arguments are:
|
|||
* `ops`: list of operators who can do things like make the bot join other channels or quit (default: empty list)
|
||||
* `plugin_dir`: directory where the bot should look for plugins (default: "plugins")
|
||||
* `log_level`: string indicating logging level. Logging can be disabled by setting this to "off". (default: "info")
|
||||
* `ns_pass`: this is the password to identify with nickserv
|
||||
* `server_pass`: password for the server
|
||||
* `ssl_required`: boolean to turn ssl on or off
|
||||
|
||||
### Creating a Twitch Bot
|
||||
Pinhook has a baked in way to connect directly to a twitch channel
|
||||
|
||||
```python
|
||||
import pinhook.bot
|
||||
|
||||
bot = pinhook.bot.TwitchBot(
|
||||
nickname='ph-bot',
|
||||
channel='#channel',
|
||||
token='super-secret-oauth-token'
|
||||
)
|
||||
bot.start()
|
||||
```
|
||||
This function has far less options, as the server, port, and ssl are already handled by twitch.
|
||||
|
||||
Optional aguments are:
|
||||
* `ops`
|
||||
* `plugin_dir`
|
||||
* `log_level`
|
||||
|
||||
These options are the same for both IRC and Twitch
|
||||
|
||||
### Creating plugins
|
||||
In your chosen plugins directory ("plugins" by default) make a python file with a function. You can use the `@pinhook.plugin.register` decorator to tell the bot the command to activate the function.
|
||||
|
|
34
README.rst
34
README.rst
|
@ -13,8 +13,8 @@ Installation
|
|||
|
||||
$ pip install pinhook
|
||||
|
||||
Creating the Bot
|
||||
~~~~~~~~~~~~~~~~
|
||||
Creating an IRC Bot
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To create the bot, just create a python file with the following:
|
||||
|
||||
|
@ -42,6 +42,36 @@ Optional arguments are:
|
|||
(default: "plugins")
|
||||
- ``log_level``: string indicating logging level. Logging can be
|
||||
disabled by setting this to "off". (default: "info")
|
||||
- ``ns_pass``: this is the password to identify with nickserv
|
||||
- ``server_pass``: password for the server
|
||||
- ``ssl_required``: boolean to turn ssl on or off
|
||||
|
||||
Creating a Twitch Bot
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Pinhook has a baked in way to connect directly to a twitch channel
|
||||
|
||||
.. code:: python
|
||||
|
||||
import pinhook.bot
|
||||
|
||||
bot = pinhook.bot.TwitchBot(
|
||||
nickname='ph-bot',
|
||||
channel='#channel',
|
||||
token='super-secret-oauth-token'
|
||||
)
|
||||
bot.start()
|
||||
|
||||
This function has far less options, as the server, port, and ssl are
|
||||
already handled by twitch.
|
||||
|
||||
Optional aguments are:
|
||||
|
||||
- ``ops``
|
||||
- ``plugin_dir``
|
||||
- ``log_level``
|
||||
|
||||
These options are the same for both IRC and Twitch
|
||||
|
||||
Creating plugins
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import pinhook.bot
|
||||
|
||||
bot = pinhook.bot.TwitchBot('ph-bot', '#example', 'supersecrettokenhere')
|
||||
bot.start()
|
|
@ -0,0 +1,7 @@
|
|||
import pinhook.plugin
|
||||
|
||||
@pinhook.plugin.register('!test')
|
||||
def test(msg):
|
||||
msg.logger.info('This is test log output')
|
||||
return pinhook.plugin.message("{}: Test".format(msg.nick))
|
||||
|
Loading…
Reference in New Issue