Various Fixes.

generified the Worldboss module; removed the spammy-section as of currently, will be readded at a later stage.
This commit is contained in:
2022-06-24 18:10:45 +02:00
parent e942ac43fa
commit 84a5933490
20 changed files with 274 additions and 176 deletions
+1 -2
View File
@@ -89,8 +89,7 @@ class CommandService:
command_key = self.get_command_key(cmd_name.lower(), sub_command.lower() if sub_command else "")
al = access_levels.get(command_key, None)
if al is not None and al != access_level.lower():
print(handler)
raise Exception(f"Different access levels specified for forms of command '{command_key}'")
raise Exception(f"Different access levels specified for forms of command '{command_key}' with handler '{handler}'")
access_levels[command_key] = access_level
self.register(handler, cmd_name, params, access_level, description, inst.module_name, help_text,
+1 -1
View File
@@ -48,7 +48,7 @@ class IgnCore:
self.last_timer_event = 0
self.start_time = int(time.time())
self.major_version = "IGNCore v2.9"
self.minor_version = "4"
self.minor_version = "5"
self.incoming_queue = FifoQueue()
self.mass_message_queue = None
self.conns = DictObject()
+8 -2
View File
@@ -35,6 +35,7 @@ class OrgPorkService:
cache_result = self.cache_service.retrieve(self.CACHE_GROUP, cache_key)
is_cache = False
result = None
if cache_result and cache_result.last_modified > (t - self.CACHE_MAX_AGE):
result = json.loads(cache_result.data)
is_cache = True
@@ -43,8 +44,13 @@ class OrgPorkService:
try:
r = requests.get(url, timeout=5)
result = r.json()
d = r.json()
if len(d[1]) > 0:
result = d
elif cache_result:
result = json.loads(cache_result.data)
if not result:
return None
# if data is invalid
if result[0]["ORG_INSTANCE"] != org_id:
result = None
+4 -2
View File
@@ -113,7 +113,8 @@ class Text:
return count
def zfill(self, numb, highest_number):
return f"<black>{(self.get_count_digits(highest_number) - self.get_count_digits(numb)) * '0'}</black>{numb}"
val = (self.get_count_digits(highest_number) - self.get_count_digits(numb))
return f"{('<black>'+ (val * '0')+'</black>') if val > 0 else ''}{numb}"
def format_pagination(self, data, offset, page, formatter, title, no_data_msg, cmd, page_size=10, headline=""):
selected = data[offset:offset + page_size]
@@ -330,7 +331,7 @@ class Text:
def format_message(self, msg, replace_br=True):
for t in ["</header>", "</header2>", "</highlight>", "</notice>", "</black>", "</white>", "</yellow>",
"</blue>", "</green>", "</red>", "</orange>", "</grey>", "</cyan>",
"</violet>", "</neutral>", "</omni>", "</clan>", "</unknown>"]:
"</violet>", "</neutral>", "</omni>", "</clan>", "</unknown>", "</gold>"]:
msg = msg.replace(t, "</font>")
if replace_br:
msg = msg.replace("<br>", "\n")
@@ -344,6 +345,7 @@ class Text:
.replace("<yellow>", "<font color=#FFFF00>") \
.replace("<blue>", "<font color=#8CB5FF>") \
.replace("<green>", "<font color=#00DE42>") \
.replace("<gold>", "<font color=#FFD700>") \
.replace("<red>", "<font color=#FF0000>") \
.replace("<orange>", "<font color=#FCA712>") \
.replace("<grey>", "<font color=#C3C3C3>") \