diff --git a/README.md b/README.md index ea46a9c..6dabd6d 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,17 @@ It also contains the following IRC functions: * `action`: same as privmsg, but does a CTCP action. (i.e., `/me does a thing`) * `notice`: send a notice +You can optionally use the `@pinhook.plugin.ops` decorator to denote that a command should only be executable by a bot op. +* If you specify the optional second argument, it will be displayed when a non-op attempts to execute the command + +The function will need to be structured as such: +```python +@pinhook.plugin.register('!test') +@pinhook.plugin.ops('!test', 'Only ops can run this command!') +def test_plugin(msg): + return pinhook.plugin.message('This was run by an op!') +``` + **OR** The plugin function can return one of the following in order to give a response to the command: diff --git a/pinhook/bot.py b/pinhook/bot.py index 869be73..86fabc3 100644 --- a/pinhook/bot.py +++ b/pinhook/bot.py @@ -11,7 +11,6 @@ import irc.bot irc.client.ServerConnection.buffer_class.errors = 'replace' -print('LOADED LOCAL!') class Bot(irc.bot.SingleServerIRCBot): def __init__(self, channels, nickname, server, **kwargs): @@ -136,7 +135,6 @@ class Bot(irc.bot.SingleServerIRCBot): self.process_event(c, e) def call_help(self, op): - print('HELP', pinhook.plugin.cmds) helplist = sorted([i for i in pinhook.plugin.cmds if op or not ('ops' in pinhook.plugin.cmds[i] and pinhook.plugin.cmds[i]['ops'])]) msg = ', '.join(helplist) return self.output_message('Available commands: {}'.format(msg))