mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 19:24:23 +00:00
Update to the 3.0.0 V
This commit is contained in:
@@ -5,24 +5,20 @@ if TYPE_CHECKING:
|
||||
from mods.jsonrpc.mod_jsonrpc import Jsonrpc
|
||||
|
||||
def thread_subscribe(uplink: 'Jsonrpc') -> None:
|
||||
response: dict[str, dict] = {}
|
||||
|
||||
snickname = uplink.Config.SERVICE_NICKNAME
|
||||
schannel = uplink.Config.SERVICE_CHANLOG
|
||||
uplink.is_streaming = True
|
||||
response = asyncio.run(uplink.LiveRpc.subscribe(["all"]))
|
||||
|
||||
if uplink.UnrealIrcdRpcLive.get_error.code == 0:
|
||||
uplink.is_streaming = True
|
||||
response = asyncio.run(uplink.UnrealIrcdRpcLive.subscribe(["all"]))
|
||||
else:
|
||||
if response.error.code != 0:
|
||||
uplink.Protocol.send_priv_msg(nick_from=snickname,
|
||||
msg=f"[{uplink.Config.COLORS.red}JSONRPC ERROR{uplink.Config.COLORS.nogc}] {uplink.UnrealIrcdRpcLive.get_error.message}",
|
||||
msg=f"[{uplink.Config.COLORS.red}JSONRPC ERROR{uplink.Config.COLORS.nogc}] {response.error.message}",
|
||||
channel=schannel
|
||||
)
|
||||
|
||||
if response is None:
|
||||
return
|
||||
|
||||
code = response.get('error', {}).get('code', 0)
|
||||
message = response.get('error', {}).get('message', None)
|
||||
code = response.error.code
|
||||
message = response.error.message
|
||||
|
||||
if code == 0:
|
||||
uplink.Protocol.send_priv_msg(
|
||||
@@ -39,18 +35,15 @@ def thread_subscribe(uplink: 'Jsonrpc') -> None:
|
||||
|
||||
def thread_unsubscribe(uplink: 'Jsonrpc') -> None:
|
||||
|
||||
response: dict[str, dict] = asyncio.run(uplink.UnrealIrcdRpcLive.unsubscribe())
|
||||
response = asyncio.run(uplink.LiveRpc.unsubscribe())
|
||||
uplink.Logs.debug("[JSONRPC UNLOAD] Unsubscribe from the stream!")
|
||||
uplink.is_streaming = False
|
||||
uplink.update_configuration('jsonrpc', 0)
|
||||
snickname = uplink.Config.SERVICE_NICKNAME
|
||||
schannel = uplink.Config.SERVICE_CHANLOG
|
||||
|
||||
if response is None:
|
||||
return None
|
||||
|
||||
code = response.get('error', {}).get('code', 0)
|
||||
message = response.get('error', {}).get('message', None)
|
||||
code = response.error.code
|
||||
message = response.error.message
|
||||
|
||||
if code != 0:
|
||||
uplink.Protocol.send_priv_msg(
|
||||
|
||||
Reference in New Issue
Block a user