Fix for mrelay - some bots are sending malformed messages, caused by wrong usage of their modules.

Accessing an external service through the bot for gathering tower data is nolonger supported; and should be done via external scripts.
Fix for callers, and missing alias'es for loot tables.
!accounts will only show mains now.
the character order of all alt lists has been reversed: [main] high => low instead of [main] low => high
!account add <name> also marks accounts as type 0, if an account gets re-enabled. might cause strange behaviour with member-logs, if used in onlinebots.
Member type is being displayed in !account now. [Member (X)]
This commit is contained in:
2021-09-19 14:09:44 +02:00
parent 5acfb6866a
commit 810c2c8c4d
9 changed files with 69 additions and 111 deletions
+27 -25
View File
@@ -99,6 +99,9 @@ class LootListsController:
self.command_alias_service.add_alias("taurus", "pande taurus")
self.command_alias_service.add_alias("sagittarius", "pande sagittarius")
self.command_alias_service.add_alias("tnh", "pande tnh")
self.command_alias_service.add_alias("barmor", "pande barmor")
self.command_alias_service.add_alias("bstars", "pande bstars")
self.command_alias_service.add_alias("bweapons", "pande bweapons")
self.command_alias_service.add_alias("s7", "apf s7")
self.command_alias_service.add_alias("s13", "apf s13")
@@ -138,9 +141,9 @@ class LootListsController:
items = self.get_items("APF", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "APF", category, add_all))
return ChatBlob(f"{category} loot table", self.build_list(items, "APF", category, add_all))
else:
return "No loot registered for <highlight>%s<end>." % category
return f"No loot registered for <highlight>{category}<end>."
@command(command="apf", params=[], description="Get list of items from APF", access_level="member")
def apf_tables_cmd(self, _):
@@ -162,9 +165,9 @@ class LootListsController:
items = self.get_items("Albtraum", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "Albtraum", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "Albtraum", category))
else:
return "No loot registered for <highlight>%s<end>." % category
return f"No loot registered for <highlight>{category}<end>."
# #
# Pandemonium #
@@ -180,9 +183,9 @@ class LootListsController:
items = self.get_items("Pande", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "Pande", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "Pande", category))
else:
return "No loot registered for <highlight>%s<end>." % category_name
return f"No loot registered for <highlight>{category_name}<end>."
@command(command="pande", params=[], description="Get list of items from Pandemonium", access_level="member")
def pande_tables_cmd(self, _):
@@ -197,9 +200,9 @@ class LootListsController:
category = self.get_real_category_name(category)
items = self.get_items("DustBrigade", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "DustBrigade", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "DustBrigade", category))
else:
return "No loot registered for <highlight>%s<end>." % category
return f"No loot registered for <highlight>{category}<end>."
@command(command="db", params=[], description="Get list of items from DustBrigade", access_level="member")
def db_tables_cmd(self, _):
@@ -222,7 +225,7 @@ class LootListsController:
else:
blob += self.build_list(self.get_items(category, sub), category, sub)
return ChatBlob("%s loot table" % category, blob)
return ChatBlob(f"{category} loot table", blob)
@command(command="xan", params=[], description="Get list of items from Xan", access_level="member")
def xan_tables_cmd(self, _):
@@ -230,14 +233,14 @@ class LootListsController:
raids = ["Mitaar", "Vortexx", "12Man"]
for raid in raids:
show_loot = self.text.make_chatcmd(
"Loot table", "/tell <myname> xan %s" % self.get_real_category_name(raid, True))
show_loot = self.text.make_chatcmd("Loot table",
f"/tell <myname> xan {self.get_real_category_name(raid, True)}")
sql = "SELECT COUNT(*) AS count FROM raid_loot WHERE raid = ?"
count = self.db.query_single(sql, [raid]).count
blob += "%s - %s items\n" % (raid, count)
blob += " └ [%s]\n\n" % show_loot
blob += f"{raid} - {count} items\n"
blob += f" └ [{show_loot}]\n\n"
return ChatBlob("Xan loot tables", blob)
@@ -250,9 +253,9 @@ class LootListsController:
category = self.get_real_category_name(category_name)
items = self.get_items("Pyramid of Home", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "poh", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "poh", category))
else:
return "No loot registered for <highlight>%s<end>." % category_name
return f"No loot registered for <highlight>{category_name}<end>."
@command(command="poh", params=[], description="Get list of items from Pyramid of Home", access_level="member")
def poh_tables_cmd(self, _):
@@ -270,9 +273,9 @@ class LootListsController:
category = self.get_real_category_name(category_name)
items = self.get_items("Temple of Three Winds (HL)", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "totwh", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "totwh", category))
else:
return "No loot registered for <highlight>%s<end>." % category_name
return f"No loot registered for <highlight>{category_name}<end>."
@command(command="totwh", params=[], description="Get list of items from Temple of Three Winds", access_level="member")
def totwh_tables_cmd(self, _):
@@ -289,9 +292,9 @@ class LootListsController:
category = self.get_real_category_name(category_name)
items = self.get_items("Condemned Subway (HL)", category)
if items:
return ChatBlob("%s loot table" % category, self.build_list(items, "subh", category))
return ChatBlob(f"{category} loot table", self.build_list(items, "subh", category))
else:
return "No loot registered for <highlight>%s<end>." % category_name
return f"No loot registered for <highlight>{category_name}<end>."
@command(command="subh", params=[], description="Get list of items from Condemned Subway (HL)",
access_level="member")
@@ -305,13 +308,13 @@ class LootListsController:
raids = self.db.query(sql, [name])
for raid in raids:
show_loot = self.text.make_chatcmd(
"Loot table", "/tell <myname> %s %s" % (cmd, self.get_real_category_name(raid.category, True)))
"Loot table", f"/tell <myname> {cmd} {self.get_real_category_name(raid.category, True)}")
sql = "SELECT COUNT(*) AS count FROM raid_loot WHERE category = ? and raid=?"
count = self.db.query_single(sql, [raid.category, name]).count
blob += "<highlight>%s<end> - %s items\n" % (raid.category, count)
blob += " └ [%s]\n\n" % show_loot
blob += f"<highlight>{raid.category}<end> - {count} items\n"
blob += f" └ [{show_loot}]\n\n"
blob += "<pagebreak>"
if not name and not cmd:
raids = [
@@ -347,10 +350,9 @@ class LootListsController:
blob = ""
if add_all:
blob += "%s items to loot list\n\n" % self.text.make_chatcmd(
"Add all", f"/tell <myname> loot addraid {raid} {category}")
blob += f"{self.text.make_chatcmd('Add all', f'/tell <myname> loot addraid {raid} {category}')} items to loot list\n\n"
blob += "<header2>%s<end>\n" % category if category is not None else ""
blob += f"<header2>{category}<end>\n" if category is not None else ""
for item in items:
comment = f" ({item.comment})" if item.comment != "" else ""