def run_plugin(self, message: SteelyMessage): parsed_message = self.parse_command_message(message.text) if parsed_message is None: return command, rest_of_message = parsed_message # Run plugins following SEP1 interface. full_message = '{} {}'.format(command, rest_of_message) matched_command, plugin, args = PluginManager.get_listener_for_command( full_message) if matched_command is not None: passed_message = copy.copy(message) passed_message.text = full_message[len(matched_command) + 1:] thread = threading.Thread(target=plugin, args=(self, passed_message), kwargs=args) thread.deamon = True thread.start() # Run normal traditional steely plugins. if not command in self.plugins: return plugin = self.plugins[command] thread = threading.Thread(target=plugin.main, args=(self, message.author_id, rest_of_message, message.thread_id, message.thread_type), kwargs={}) thread.deamon = True thread.start()
def is_new_style_command(message): message = strip_command(message) return (PluginManager.get_listener_for_command(message, logger=LOGGER) is not None)