Fixed warnings caused by non-existing messagehub channels.

Changed the setting registration, removed the warnings.
Loot roll messages are more obvious now.
Superadmins are meant to stay mostily hidden, but are being exposed in !system again.
This commit is contained in:
2021-08-29 17:54:18 +02:00
parent 82d2be8de2
commit 9f1da9a00d
24 changed files with 163 additions and 169 deletions
+19 -18
View File
@@ -93,7 +93,7 @@ class LootController:
if self.loot_list[item_index]:
self.last_modify = int(time.time())
self.bot.send_private_channel_message(
"Removed %s from loot list." % self.loot_list.pop(item_index).get_item_str())
f"Removed {self.loot_list.pop(item_index).get_item_str()} from loot list.")
else:
return "Item error."
except KeyError:
@@ -115,7 +115,7 @@ class LootController:
loot_item.count += 1
self.last_modify = int(time.time())
self.bot.send_private_channel_message(
"Increased item count for %s to %d." % (loot_item.get_item_str(), loot_item.count))
f"Increased item count for {loot_item.get_item_str()} to {loot_item.count:d}.")
else:
return "Item error."
except KeyError:
@@ -137,7 +137,7 @@ class LootController:
loot_item.count = loot_item.count - 1 if loot_item.count > 1 else 1
self.last_modify = int(time.time())
self.bot.send_private_channel_message(
"Decreased item count for %s to %d." % (loot_item.get_item_str(), loot_item.count))
f"Decreased item count for {loot_item.get_item_str()} to {loot_item.count:d}.")
else:
return "Item error."
except KeyError:
@@ -173,12 +173,12 @@ class LootController:
self.last_modify = int(time.time())
if old_item is not None:
text = "moved from %s to %s." % (old_item.get_item_str(), loot_item.get_item_str())
self.bot.send_mass_message(request.sender.char_id, "You have %s" % text)
text = f"moved from {old_item.get_item_str()} to {loot_item.get_item_str()}."
self.bot.send_mass_message(request.sender.char_id, f"You have {text}")
self.bot.send_private_channel_message(request.sender.name + " " + text)
else:
text = "added to %s." % loot_item.get_item_str()
self.bot.send_mass_message(request.sender.char_id, "You have %s" % text)
text = f"added to {loot_item.get_item_str()}."
self.bot.send_mass_message(request.sender.char_id, f"You have {text}")
self.bot.send_private_channel_message(request.sender.name + " " + text)
except KeyError:
@@ -193,8 +193,8 @@ class LootController:
loot_item.bidders.remove(request.sender.name)
self.last_modify = int(time.time())
text = "removed from %s." % loot_item.get_item_str()
self.bot.send_private_message(request.sender.char_id, "You were %s" % text)
text = f"removed from {loot_item.get_item_str()}."
self.bot.send_private_message(request.sender.char_id, f"You were {text}")
self.bot.send_private_channel_message(request.sender.name + " was " + text)
else:
return "You are not added to any loot."
@@ -230,15 +230,14 @@ class LootController:
"loot",
f"{loot_item.get_item_str()}",
request.sender.char_id)
blob += "%d. %s\n" % (i, loot_item.get_item_str())
blob += " | Winners: <red>%s<end>\n\n" % '<end>, <red>'.join(winners)
blob += f"{i:d}. {loot_item.get_item_str()}\n"
blob += f" | Winners: <red>{'<end>, <red>'.join(winners)}<end>\n\n"
if loot_item.count == 0:
remove.append(i)
for i in remove:
self.loot_list.pop(i)
msg = ChatBlob("Roll results", blob)
msg.page_prefix = "Time is up! "
msg = ChatBlob("Roll results", blob, "\n________________\n\n<red>Time is UP!</red>\n", "\n________________")
self.bot.send_private_channel_message(msg if len(blob) > 0 else "No one was added to any loot")
if self.loot_list:
count = 1
@@ -250,6 +249,8 @@ class LootController:
del self.loot_list[key]
self.loot_list[count] = loot_item
count += 1
if len(self.loot_list) > 0:
self.bot.send_private_channel_message(f"Theres still loot left to roll, the list has been rebuilt.")
else:
return "No loot to roll."
@@ -267,9 +268,9 @@ class LootController:
if item:
self.add_item_to_loot(item, item.comment, item_count)
self.bot.send_private_channel_message("Added %s to loot list." % item.name)
self.bot.send_private_channel_message(f"Added {item.name} to loot list.")
else:
return "Failed to add item with ID %s." % raid_item_id
return f"Failed to add item with ID {raid_item_id}."
@command(command="loot", params=[Const("addraid"), Any("raid"), Any("category")],
description="Add all loot from pre-defined raid", access_level="leader", sub_command="modify")
@@ -313,7 +314,7 @@ class LootController:
self.add_item_to_loot(item, item_count=item_count)
self.bot.send_private_channel_message("%s was added to loot list." % item.name)
self.bot.send_private_channel_message(f"{item.name} was added to loot list.")
@command(command="loot",
params=[Const("additem", is_optional=True), Any("item"), Int("item_count", is_optional=True)],
@@ -397,8 +398,8 @@ class LootController:
f"[ {self.text.make_tellcmd('REM', f'loot remitem {i}')} ]</yellow>\n\n"
else:
if len(bidders) > 0:
blob += "<yellow>%s<end>\n\n" % ', '.join(bidders)
blob += f"<yellow>{', '.join(bidders)}<end>\n\n"
else:
blob += "<yellow>None added<end>\n\n"
return ChatBlob("Loot (%d)" % len(self.loot_list), blob)
return ChatBlob(f"Loot ({len(self.loot_list):d})", blob)
@@ -113,7 +113,7 @@ class LootListsController:
self.command_alias_service.add_alias("alba", "albtraum")
self.command_alias_service.add_alias("lt", "loottables")
self.command_alias_service.add_alias("raids", "loottables")
# self.command_alias_service.add_alias("raids", "loottables")
self.command_alias_service.add_alias("ltables", "loottables")
self.command_alias_service.add_alias("loots", "loottables")