Skip to content

Commit

Permalink
Merge pull request #52 from adator85/dev
Browse files Browse the repository at this point in the history
You need to have unrealirc_rpc_py v1.0.3
  • Loading branch information
adator85 authored Sep 29, 2024
2 parents f7b49c1 + f2b5c48 commit 80b329d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions mods/mod_jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def __init_module(self) -> None:
if self.Rpc.Error.code != 0:
self.Irc.sendPrivMsg(f"[{self.Config.COLORS.red}ERROR{self.Config.COLORS.nogc}] {self.Rpc.Error.message}", self.Config.SERVICE_CHANLOG)

if self.UnrealIrcdRpcLive.Error.code != 0:
self.Irc.sendPrivMsg(f"[{self.Config.COLORS.red}ERROR{self.Config.COLORS.nogc}] {self.UnrealIrcdRpcLive.Error.message}", self.Config.SERVICE_CHANLOG)

return None

def __set_commands(self, commands:dict[int, list[str]]) -> None:
Expand Down Expand Up @@ -116,13 +119,29 @@ def callback_sent_to_irc(self, json_response: str):

dnickname = self.Config.SERVICE_NICKNAME
dchanlog = self.Config.SERVICE_CHANLOG
green = self.Config.COLORS.green
nogc = self.Config.COLORS.nogc
bold = self.Config.COLORS.bold
red = self.Config.COLORS.red

if json_response.result == True:
self.Irc.sendPrivMsg(msg=f"[{bold}{green}JSONRPC{nogc}{bold}] Event activated", channel=dchanlog)
return None

level = json_response.result.level
subsystem = json_response.result.subsystem
event_id = json_response.result.event_id
log_source = json_response.result.log_source
msg = json_response.result.msg

build_msg = f"{green}{log_source}{nogc}: [{bold}{level}{bold}] {subsystem}.{event_id} - {msg}"

self.Irc.sendPrivMsg(msg=json_response, channel=dchanlog)
self.Irc.sendPrivMsg(msg=build_msg, channel=dchanlog)

def thread_start_jsonrpc(self):

if self.UnrealIrcdRpcLive.Error.code == 0:
self.UnrealIrcdRpcLive.subscribe()
self.UnrealIrcdRpcLive.subscribe(["all"])
self.subscribed = True
else:
self.Irc.sendPrivMsg(f"[{self.Config.COLORS.red}ERROR{self.Config.COLORS.nogc}] {self.UnrealIrcdRpcLive.Error.message}", self.Config.SERVICE_CHANLOG)
Expand Down

0 comments on commit 80b329d

Please sign in to comment.