mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 11:14:23 +00:00
Moving rpc module to rpc package v2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
from dataclasses import dataclass
|
||||
from unrealircd_rpc_py.Live import Live
|
||||
from unrealircd_rpc_py.Live import LiveWebsocket
|
||||
from unrealircd_rpc_py.Loader import Loader
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -63,13 +63,12 @@ class Jsonrpc():
|
||||
self.__load_module_configuration()
|
||||
# End of mandatory methods you can start your customization #
|
||||
|
||||
self.UnrealIrcdRpcLive: Live = Live(
|
||||
req_method='websocket',
|
||||
self.UnrealIrcdRpcLive: LiveWebsocket = LiveWebsocket(
|
||||
url=self.Config.JSONRPC_URL,
|
||||
username=self.Config.JSONRPC_USER,
|
||||
password=self.Config.JSONRPC_PASSWORD,
|
||||
callback_object_instance=self,
|
||||
callback_method_name='callback_sent_to_irc'
|
||||
callback_method_or_function_name='callback_sent_to_irc'
|
||||
)
|
||||
|
||||
if self.UnrealIrcdRpcLive.get_error.code != 0:
|
||||
@@ -133,7 +132,7 @@ class Jsonrpc():
|
||||
red = self.Config.COLORS.red
|
||||
|
||||
if hasattr(response, 'result'):
|
||||
if response.result == True:
|
||||
if isinstance(response.result, bool) and response.result:
|
||||
self.Protocol.send_priv_msg(
|
||||
nick_from=self.Config.SERVICE_NICKNAME,
|
||||
msg=f"[{bold}{green}JSONRPC{nogc}{bold}] Event activated",
|
||||
@@ -148,6 +147,10 @@ class Jsonrpc():
|
||||
|
||||
build_msg = f"{green}{log_source}{nogc}: [{bold}{level}{bold}] {subsystem}.{event_id} - {msg}"
|
||||
|
||||
# Check if there is an error
|
||||
if self.UnrealIrcdRpcLive.get_error.code != 0:
|
||||
self.Logs.error(f"RpcLiveError: {self.UnrealIrcdRpcLive.get_error.message}")
|
||||
|
||||
self.Protocol.send_priv_msg(nick_from=dnickname, msg=build_msg, channel=dchanlog)
|
||||
|
||||
def thread_start_jsonrpc(self):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
"requests": "2.32.3",
|
||||
"psutil": "6.0.0",
|
||||
"unrealircd_rpc_py": "1.1.0",
|
||||
"unrealircd_rpc_py": "2.0.0",
|
||||
"sqlalchemy": "2.0.35",
|
||||
"faker": "30.1.0"
|
||||
}
|
||||
Reference in New Issue
Block a user