mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-14 03:34:23 +00:00
Compare commits
43 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b27b503d78 | ||
|
|
36e3835e6c | ||
|
|
2c78025bfb | ||
|
|
979ba40c05 | ||
|
|
cea69c1580 | ||
|
|
c404cc3234 | ||
|
|
80b329dd5d | ||
|
|
f7b49c151f | ||
|
|
1ee9b7e3ff | ||
|
|
4d0087623c | ||
|
|
dc20f5ec3c | ||
|
|
110cae3b84 | ||
|
|
857cbfc85d | ||
|
|
3518589e9c | ||
|
|
e14c97de03 | ||
|
|
69360be3ad | ||
|
|
bfa90c6bd5 | ||
|
|
5c8378a0e7 | ||
|
|
e3b212ea88 | ||
|
|
0c2a350d38 | ||
|
|
1cea8d0601 | ||
|
|
652b400d5e | ||
|
|
2f8b965b59 | ||
|
|
3c043cefd8 | ||
|
|
59a75cecd8 | ||
|
|
71053437a7 | ||
|
|
7796d05206 | ||
|
|
5f2567f9e5 | ||
|
|
aaa1dd9a1a | ||
|
|
a02f2f9a26 | ||
|
|
d73adb6f0b | ||
|
|
b812e64992 | ||
|
|
9bd1f68df2 | ||
|
|
f44b08bf36 | ||
|
|
1a19e1613a | ||
|
|
cdc15b7b47 | ||
|
|
31fe9f62ec | ||
|
|
f0853e3afb | ||
|
|
6dade09257 | ||
|
|
9533b010b2 | ||
|
|
824db73590 | ||
|
|
96bf4b6f80 | ||
|
|
922336363e |
@@ -490,8 +490,7 @@ class Irc:
|
|||||||
self.Base.db_record_module(fromuser, module_name)
|
self.Base.db_record_module(fromuser, module_name)
|
||||||
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Module {module_name} chargé")
|
self.send2socket(f":{self.Config.SERVICE_NICKNAME} PRIVMSG {self.Config.SERVICE_CHANLOG} :Module {module_name} chargé")
|
||||||
|
|
||||||
# self.Base.logs.info(self.loaded_classes)
|
self.Base.logs.info(self.loaded_classes)
|
||||||
self.Base.logs.info(f"Module {class_name} has been loaded")
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except ModuleNotFoundError as moduleNotFound:
|
except ModuleNotFoundError as moduleNotFound:
|
||||||
|
|||||||
@@ -213,7 +213,6 @@ class Command():
|
|||||||
dnickname = self.Config.SERVICE_NICKNAME
|
dnickname = self.Config.SERVICE_NICKNAME
|
||||||
service_id = self.Config.SERVICE_ID
|
service_id = self.Config.SERVICE_ID
|
||||||
dchanlog = self.Config.SERVICE_CHANLOG
|
dchanlog = self.Config.SERVICE_CHANLOG
|
||||||
self.user_to_notice = user
|
|
||||||
fromuser = user
|
fromuser = user
|
||||||
fromchannel = channel
|
fromchannel = channel
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class Jsonrpc():
|
|||||||
class ModConfModel:
|
class ModConfModel:
|
||||||
"""The Model containing the module parameters
|
"""The Model containing the module parameters
|
||||||
"""
|
"""
|
||||||
jsonrpc: int = 0
|
param_exemple1: str
|
||||||
|
param_exemple2: int
|
||||||
|
|
||||||
def __init__(self, ircInstance:Irc) -> None:
|
def __init__(self, ircInstance:Irc) -> None:
|
||||||
|
|
||||||
@@ -71,8 +72,7 @@ class Jsonrpc():
|
|||||||
username=self.Config.JSONRPC_USER,
|
username=self.Config.JSONRPC_USER,
|
||||||
password=self.Config.JSONRPC_PASSWORD,
|
password=self.Config.JSONRPC_PASSWORD,
|
||||||
callback_object_instance=self,
|
callback_object_instance=self,
|
||||||
callback_method_name='callback_sent_to_irc',
|
callback_method_name='callback_sent_to_irc'
|
||||||
debug_level=10
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.Rpc: Loader = Loader(
|
self.Rpc: Loader = Loader(
|
||||||
@@ -90,9 +90,6 @@ class Jsonrpc():
|
|||||||
if self.UnrealIrcdRpcLive.Error.code != 0:
|
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)
|
self.Irc.sendPrivMsg(f"[{self.Config.COLORS.red}ERROR{self.Config.COLORS.nogc}] {self.UnrealIrcdRpcLive.Error.message}", self.Config.SERVICE_CHANLOG)
|
||||||
|
|
||||||
if self.ModConfig.jsonrpc == 1:
|
|
||||||
self.Base.create_thread(self.thread_start_jsonrpc, run_once=True)
|
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __set_commands(self, commands:dict[int, list[str]]) -> None:
|
def __set_commands(self, commands:dict[int, list[str]]) -> None:
|
||||||
@@ -165,10 +162,10 @@ class Jsonrpc():
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# Build the default configuration model (Mandatory)
|
# Build the default configuration model (Mandatory)
|
||||||
self.ModConfig = self.ModConfModel(jsonrpc=0)
|
self.ModConfig = self.ModConfModel(param_exemple1='param value 1', param_exemple2=1)
|
||||||
|
|
||||||
# Sync the configuration with core configuration (Mandatory)
|
# Sync the configuration with core configuration (Mandatory)
|
||||||
self.Base.db_sync_core_config(self.module_name, self.ModConfig)
|
#self.Base.db_sync_core_config(self.module_name, self.ModConfig)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -197,7 +194,6 @@ class Jsonrpc():
|
|||||||
|
|
||||||
command = str(cmd[0]).lower()
|
command = str(cmd[0]).lower()
|
||||||
dnickname = self.Config.SERVICE_NICKNAME
|
dnickname = self.Config.SERVICE_NICKNAME
|
||||||
dchannel = self.Config.SERVICE_CHANLOG
|
|
||||||
fromuser = user
|
fromuser = user
|
||||||
fromchannel = str(channel) if not channel is None else None
|
fromchannel = str(channel) if not channel is None else None
|
||||||
|
|
||||||
@@ -214,19 +210,10 @@ class Jsonrpc():
|
|||||||
match option:
|
match option:
|
||||||
|
|
||||||
case 'on':
|
case 'on':
|
||||||
for thread in self.Base.running_threads:
|
|
||||||
if thread.getName() == 'thread_start_jsonrpc':
|
|
||||||
if thread.is_alive():
|
|
||||||
self.Irc.sendPrivMsg(f"Thread {thread.getName()} is running", dchannel)
|
|
||||||
else:
|
|
||||||
self.Irc.sendPrivMsg(f"Thread {thread.getName()} is not running, wait untill the process will be cleaned up", dchannel)
|
|
||||||
|
|
||||||
self.Base.create_thread(self.thread_start_jsonrpc, run_once=True)
|
self.Base.create_thread(self.thread_start_jsonrpc, run_once=True)
|
||||||
self.__update_configuration('jsonrpc', 1)
|
|
||||||
|
|
||||||
case 'off':
|
case 'off':
|
||||||
self.UnrealIrcdRpcLive.unsubscribe()
|
self.UnrealIrcdRpcLive.unsubscribe()
|
||||||
self.__update_configuration('jsonrpc', 0)
|
|
||||||
|
|
||||||
except IndexError as ie:
|
except IndexError as ie:
|
||||||
self.Logs.error(ie)
|
self.Logs.error(ie)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "5.4.0",
|
"version": "5.3.9",
|
||||||
|
|
||||||
"requests": "2.32.3",
|
"requests": "2.32.3",
|
||||||
"psutil": "6.0.0",
|
"psutil": "6.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user