feat: 插件支持正则匹配

This commit is contained in:
Soulter
2024-08-05 12:12:00 -04:00
parent abda226d63
commit 14dbdb2d83
5 changed files with 39 additions and 13 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ class CommandRegisterRequest():
description: str
priority: int
handler: Callable
use_regex: bool = False
plugin_name: str = None
class PluginCommandBridge():
@@ -20,6 +21,6 @@ class PluginCommandBridge():
self.plugin_commands_waitlist: List[CommandRegisterRequest] = []
self.cached_plugins = cached_plugins
def register_command(self, plugin_name, command_name, description, priority, handler):
self.plugin_commands_waitlist.append(CommandRegisterRequest(command_name, description, priority, handler, plugin_name))
def register_command(self, plugin_name, command_name, description, priority, handler, use_regex=False):
self.plugin_commands_waitlist.append(CommandRegisterRequest(command_name, description, priority, handler, use_regex, plugin_name))