small loader refactoring

This commit is contained in:
AAGaming
2024-02-14 17:49:27 -05:00
parent 9db3f3f20e
commit 091428f683
2 changed files with 8 additions and 12 deletions
+2 -5
View File
@@ -14,7 +14,7 @@ from typing import Any, Callable, Coroutine, Dict, List
EmittedEventCallbackType = Callable[[str, Any], Coroutine[Any, Any, Any]]
class PluginWrapper:
def __init__(self, file: str, plugin_directory: str, plugin_path: str) -> None:
def __init__(self, file: str, plugin_directory: str, plugin_path: str, emit_callback: EmittedEventCallbackType) -> None:
self.file = file
self.plugin_path = plugin_path
self.plugin_directory = plugin_directory
@@ -41,7 +41,7 @@ class PluginWrapper:
self._listener_task: Task[Any]
self._method_call_requests: Dict[str, MethodCallRequest] = {}
self.emitted_event_callback: EmittedEventCallbackType
self.emitted_event_callback: EmittedEventCallbackType = emit_callback
self.legacy_method_warning = False
@@ -61,9 +61,6 @@ class PluginWrapper:
except:
pass
def set_emitted_event_callback(self, callback: EmittedEventCallbackType):
self.emitted_event_callback = callback
async def execute_legacy_method(self, method_name: str, kwargs: Dict[Any, Any]):
if not self.legacy_method_warning:
self.legacy_method_warning = True