Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates README and passes IRCClient instance to hooks

  • Loading branch information...
commit 9ec4a5f52bc67bb764f381bd886d993345d95eb1 1 parent a4d5699
@DrMegahertz DrMegahertz authored
Showing with 18 additions and 8 deletions.
  1. +17 −7 README.md
  2. +1 −1  ircbot.py
View
24 README.md
@@ -1,24 +1,34 @@
pycri
-----
-Modular IRC-bot with support for live reloading of plugins. Support for TCP- and SSL-connections.
+
+Modular IRC-bot with support for live reloading of plugins. Support for TCP-
+and SSL-connections.
Run the both with `python main.py <channel>`
Simple greeting plugin
----------------------
- from utils import base
- class Greeter(base.Plugin):
- _plugin_name = 'channel_greeter' # Plugin name is needed for the module to be loaded at all
+ from plugins import Plugin
+
+ class Greeter(Plugin):
+ def on_join(self, irc, prefix, params):
+ nick, channel = prefix.split('!')[0], params[0]
+
+ message = 'Welcome to {0}, {1}. Have a pleasant stay!'.format(
+ channel, nick
+ )
- def on_user_joined(self, user, channel): # The `on_user_joined` hook sends with the class itself, the bot-instance and the user joined as well as the channel for the event
- irc.msg(channel, 'Welcome to {}, {}. Have a pleasant stay!'.format(channel, user.split('!')[0))
+ irc.say(channel, message)
-That's it! Now either add the module to the list in plugins.\__all\__ (plugins/\__init\__.py) or load the plugin using `!loadplugin <module>`
+
+That's it! Now either add the module to the PLUGINS-list in settings.py or
+load the plugin using `!load <module>`.
Dependencies
------------
+
- twisted
- pyopenssl (if connecting over SSL)
View
2  ircbot.py
@@ -44,7 +44,7 @@ def handleCommand(self, command, prefix, params):
try:
if method:
- method(prefix, params)
+ method(self, prefix, params)
except:
pass
Please sign in to comment.
Something went wrong with that request. Please try again.