Moved org finder to the core

Allowed viewing the most recent account logs by using !account log recent
Allowed removing of chatbots
Moved the so far hardcoded org prefixing into the DB, which allows dynamically changing them.
Fix for orgrosters; org leaves are being detected now.
This commit is contained in:
2022-02-11 15:43:48 +01:00
parent 6d6bfbc678
commit d3461ef462
10 changed files with 165 additions and 77 deletions
+4 -4
View File
@@ -134,7 +134,7 @@ class CommandService:
return
for channel, label in self.channels.items():
row = self.db.query_single("SELECT access_level, module, enabled, verified "
row = self.db.query_single("SELECT access_level, module, enabled, verified, sub_command "
"FROM command_config "
"WHERE command = ? AND sub_command = ? AND channel = ?",
[command, sub_command, channel])
@@ -147,9 +147,9 @@ class CommandService:
"VALUES (?, ?, ?, ?, ?, 1, 1)",
[command, sub_command, access_level, channel, module])
elif row.verified:
if row.module != module:
self.logger.warning("module different for different forms of command '%s' and sub_command '%s'" % (
command, sub_command))
if row.module != module and row.sub_command == sub_command:
self.logger.warning(f"module different for different forms of command '{command}' "
f"and sub_command '{sub_command}'")
else:
# mark command as verified
self.db.exec("UPDATE command_config SET verified = 1, module = ? "
+1 -1
View File
@@ -43,7 +43,7 @@ class IgnCore:
self.last_timer_event = 0
self.start_time = int(time.time())
self.major_version = "IGNCore v2.8"
self.minor_version = "2"
self.minor_version = "3"
self.incoming_queue = FifoQueue()
self.mass_message_queue = None
self.conns = DictObject()
+6
View File
@@ -185,3 +185,9 @@ class OrgPorkService:
# Dont use SSL, as its rather slow compared to normal requests....
# noinspection HttpUrlsUsage
return f"http://people.anarchy-online.com/org/stats/d/{dimension}/name/{org_id}/basicstats.xml?data_type=json"
def find_org(self, search, table="all_orgs"):
if search.isdigit():
return self.db.query("SELECT * FROM " + table + " where org_id = ?", [search])
elif isinstance(search, str):
return self.db.query("SELECT * FROM " + table + " where org_name LIKE ?", ["%" + search + "%"])