Created
August 26, 2016 18:29
-
-
Save jrabbit/43fefeb9c9e8189afd6dd561989eac68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def command(internals=False): | |
"""Wraps a python function into an irc command""" | |
def decorator(wrapped): | |
def callback(scanner, name, ob): | |
scanner.registry.add(name, ob) | |
if internals: | |
if not scanner.multiplex: | |
return partial(wrapped, scanner.multiplex, scanner.multi_server) | |
return partial(wrapped, scanner.multiplex, scanner.multi_server) | |
else: | |
return wrapped | |
venusian.attach(wrapped, callback) | |
return wrapped | |
return decorator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment