diff --git a/README.md b/README.md index 8c40f1a..c8e3786 100644 --- a/README.md +++ b/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. diff --git a/README.rst b/README.rst index d5163bc..25a2d42 100644 --- a/README.rst +++ b/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 ~~~~~~~~~~~~~~~~ diff --git a/examples/ph.py b/examples/irc/ph.py similarity index 100% rename from examples/ph.py rename to examples/irc/ph.py diff --git a/examples/plugins/test.py b/examples/irc/plugins/test.py similarity index 100% rename from examples/plugins/test.py rename to examples/irc/plugins/test.py diff --git a/examples/twitch/ph.py b/examples/twitch/ph.py new file mode 100644 index 0000000..5b40fd2 --- /dev/null +++ b/examples/twitch/ph.py @@ -0,0 +1,4 @@ +import pinhook.bot + +bot = pinhook.bot.TwitchBot('ph-bot', '#example', 'supersecrettokenhere') +bot.start() \ No newline at end of file diff --git a/examples/twitch/plugins/test.py b/examples/twitch/plugins/test.py new file mode 100644 index 0000000..22908a6 --- /dev/null +++ b/examples/twitch/plugins/test.py @@ -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)) +