Snippets

Doug Freed Bp9yM: Untitled snippet

Created by Doug Freed last modified
def _command_creator(command):
    def command_function(self, *args, **kwargs):
        yield from self.signal_emit("command " + command, *args, **kwargs)
        
    @utils.hook("command " + command)
    def command_handler(self, connection, *args, **kwargs):
        if args:
            args[-1] = ":" + args[-1]
        yield from self.signal_emit("write string", " ".join(map(str, (command,) + args), **kwargs)
    
    return command_function, command_handler

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.