Changed the string formatter from % to f"",
Fixed a bug related to logging [log dir does not exist on master, and needs to get created on first startup] Added !prefadmin <user> to view preferences of players, and change them Orgrank & name will be hidden in !alts, if the character is not in an org Page prefix & suffix are now being relayed [for example, it affects !online Fixed !perks Added comments regarding external API's.
This commit is contained in:
@@ -41,6 +41,8 @@ class AccessService:
|
||||
|
||||
def get_access_level(self, char_id) -> dict:
|
||||
account = self.account_service.get_main(char_id)
|
||||
# For performance's sake, we'll assume that the main has the highest rank;
|
||||
# if it only has the rank "all" (no rank), we'll also check the toon using the command.
|
||||
if account:
|
||||
al = self.get_single_access_level(account.char_id)
|
||||
if al["label"] == "all":
|
||||
@@ -48,21 +50,6 @@ class AccessService:
|
||||
return al
|
||||
else:
|
||||
return self.get_single_access_level(char_id)
|
||||
# access_level1 = self.get_single_access_level(char_id)
|
||||
#
|
||||
# alts = self.account_service.get_alts(char_id)
|
||||
# if not alts:
|
||||
# return access_level1
|
||||
#
|
||||
# main = alts[0]
|
||||
# if main.char_id == char_id:
|
||||
# return access_level1
|
||||
# else:
|
||||
# access_level2 = self.get_single_access_level(main.char_id)
|
||||
# if access_level1["level"] < access_level2["level"]:
|
||||
# return access_level1
|
||||
# else:
|
||||
# return access_level2
|
||||
|
||||
def compare_access_levels(self, access_level1, access_level2) -> int:
|
||||
"""
|
||||
|
||||
@@ -147,13 +147,18 @@ class AccountService:
|
||||
acc_cache = {}
|
||||
|
||||
def get_account(self, char_id) -> DictObject:
|
||||
|
||||
# The way the caching is handled does not come without side effects:
|
||||
# For example, after purging an account,
|
||||
# you could still update it (i.e. add points, alts, ...)
|
||||
# which would result in log entries,
|
||||
# without an associated account
|
||||
if char_id not in self.acc_cache.keys():
|
||||
out = self.db.query_single(
|
||||
"SELECT a.*, p.* from account a left join player p on a.char_id = p.char_id where "
|
||||
"a.char_id=(SELECT main from account where char_id=?) "
|
||||
"and a.char_id not in (SELECT char_id from org_bots)",
|
||||
[char_id]) or DictObject({})
|
||||
|
||||
self.acc_cache[char_id] = out
|
||||
self.bot.job_scheduler.delayed_job(lambda x: self.acc_cache.pop(char_id), 5)
|
||||
else:
|
||||
@@ -419,7 +424,7 @@ class AccountService:
|
||||
f"LEFT JOIN (SELECT * FROM online WHERE bot=?) o ON a.char_id=o.char_id "
|
||||
f"WHERE a.char_id NOT IN (SELECT char_id from org_bots) "
|
||||
f"and a.disabled = 0 {'and o.char_id is not null' if online_only else ''} "
|
||||
f"order by a.main, a.main=a.char_id desc, p.level desc, p.ai_level desc",
|
||||
f"group by o.char_id order by a.main, a.main=a.char_id desc, p.level desc, p.ai_level desc",
|
||||
[self.bot.get_char_id()])
|
||||
|
||||
def get_by_group(self, group) -> List[DictObject]:
|
||||
|
||||
Reference in New Issue
Block a user