Fixed bidding, while not being in raid (Nolonger throws an error)
Added default alias !list for !loot (bebot like) Changed the layout of !notes, its more compact now. fixed !count in the rare case of an empty private channel
This commit is contained in:
@@ -113,7 +113,7 @@ class DingController:
|
||||
blob = self.text.format_page('Info',
|
||||
f"<header>::: Information :::</header><br><br>"
|
||||
f"This automated message has been sent to you by:<br><br>"
|
||||
f"<header2>Igncom</header2> <yellow>[<green>{sys}</green>]</yellow><br>"
|
||||
f"<header2>{self.bot.get_char_name()}</header2> <yellow>[<green>{sys}</green>]</yellow><br>"
|
||||
f"<header2>Reason for this Message: "
|
||||
f"<highlight>You dinged {level}</highlight></header2><br><br>"
|
||||
f"<header2>Have you joined The Alliance Discord yet? "
|
||||
|
||||
@@ -101,7 +101,7 @@ class RaidbotController(BaseModule):
|
||||
blob += f"Raidleader: " \
|
||||
f"<highlight>" \
|
||||
f"{self.leader.leader.name if self.leader.leader else '<red>not set - use !leader set<end>'}" \
|
||||
f"<end>"
|
||||
f"<end>\n"
|
||||
blob += f"Started At: <highlight>{self.util.format_datetime(self.raid.started_at)}<end> " \
|
||||
f"({self.util.time_to_readable(t - self.raid.started_at)} ago)\n"
|
||||
if self.raid.is_open:
|
||||
@@ -483,21 +483,21 @@ class RaidbotController(BaseModule):
|
||||
blob += f"End time: <highlight>{self.util.format_datetime(log_entry[0].raid_end)}<end>\n"
|
||||
blob += f"Run time: " \
|
||||
f"<highlight>{self.util.time_to_readable(log_entry[0].raid_end - log_entry[0].raid_start)}<end>\n"
|
||||
blob += f"Total points: <highlight>{pts_sum:d}<end>\n\n"
|
||||
blob += f"Total points: <highlight>{pts_sum}<end>\n\n"
|
||||
|
||||
if char and log_entry_spec:
|
||||
raider_name = self.character_service.resolve_char_to_name(log_entry_spec.raider_id)
|
||||
main_info = self.account_service.get_main(log_entry_spec.raider_id)
|
||||
alt_link = "Alt of %s" % main_info.name if main_info.char_id != log_entry_spec.raider_id else "Alts"
|
||||
alt_link = self.text.make_chatcmd(alt_link, "/tell <myname> alts %s" % main_info.name)
|
||||
blob += "<header2>Log entry for %s<end>\n" % raider_name
|
||||
blob += "Raider: <highlight>%s<end> [%s]\n" % (raider_name, alt_link)
|
||||
alt_link = f"Alt of {main_info.name}" if main_info.char_id != log_entry_spec.raider_id else "Alts"
|
||||
alt_link = self.text.make_chatcmd(alt_link, f"/tell <myname> alts {main_info.name}")
|
||||
blob += f"<header2>Log entry for {raider_name}<end>\n"
|
||||
blob += f"Raider: <highlight>{raider_name}<end> [{alt_link}]\n"
|
||||
blob += "Left raid: %s\n" % ("n/a"
|
||||
if log_entry_spec.left_raid is None
|
||||
else self.util.format_datetime(log_entry_spec.left_raid))
|
||||
blob += "Was kicked: %s\n" % ("No"
|
||||
if log_entry_spec.was_kicked is None
|
||||
else "Yes [%s]" % (self.util.format_datetime(log_entry_spec.was_kicked)))
|
||||
else f"Yes [{self.util.format_datetime(log_entry_spec.was_kicked)}]")
|
||||
blob += "Kick reason: %s\n\n" % ("n/a"
|
||||
if log_entry_spec.was_kicked_reason is None
|
||||
else log_entry_spec.was_kicked_reason)
|
||||
@@ -569,9 +569,9 @@ class RaidbotController(BaseModule):
|
||||
def announce_raid(self, event_type, event_data):
|
||||
if self.raid:
|
||||
if self.raid.is_open:
|
||||
self.bot.send_private_channel_message("<highlight>Raid Running<end> "
|
||||
"<yellow>::<end> <green>%s<end> <yellow>::<end> %s" %
|
||||
(self.raid.desc,
|
||||
self.bot.send_private_channel_message(f"<highlight>Raid Running<end> "
|
||||
f"<yellow>::<end> <green>{self.raid.desc}<end> <yellow>::<end> %s" %
|
||||
(
|
||||
f"<a href=\"text://{self.raid.raid_name}\">"
|
||||
f"{self.get_raid_join_blob('Click to Join')}"
|
||||
f"</a>"))
|
||||
@@ -587,6 +587,7 @@ class RaidbotController(BaseModule):
|
||||
self.bot.send_private_channel_message(f"<red>::</red> No Leader set <red>::</red> "
|
||||
f"use <highlight>!leader set</highlight>")
|
||||
return
|
||||
if not self.is_in_raid(leader.char_id):
|
||||
account = self.account_service.get_account(leader.char_id)
|
||||
if not self.is_in_raid(account.main):
|
||||
self.bot.send_private_channel_message(f"<red>::</red> Raidleader <highlight>{leader.name}</highlight> "
|
||||
f"is not in raid <red>::</red>")
|
||||
|
||||
@@ -110,13 +110,9 @@ class AuctionStrategy:
|
||||
raider: Raider = self.raid_controller.is_in_raid(main)
|
||||
if type(raider) == Raider:
|
||||
if not raider.is_active:
|
||||
self.bot.send_mass_message(request.sender.char_id,
|
||||
"You are not participating in the raid, and cannot add to the loot.")
|
||||
return
|
||||
return "You are not participating in the raid, and cannot add to the loot."
|
||||
elif raider is None:
|
||||
self.bot.send_mass_message(request.sender.char_id,
|
||||
"You are not participating in the raid, and cannot add to the loot.")
|
||||
return
|
||||
return "You are not participating in the raid, and cannot add to the loot."
|
||||
if not account:
|
||||
return "You do not have an active account with this bot."
|
||||
elif account.disabled:
|
||||
|
||||
@@ -49,6 +49,7 @@ class LootController:
|
||||
self.alias.add_alias("flatroll", "loot roll")
|
||||
self.alias.add_alias("result", "loot roll")
|
||||
self.alias.add_alias("results", "loot roll")
|
||||
self.alias.add_alias("list", "loot")
|
||||
self.alias.add_alias("win", "loot roll")
|
||||
|
||||
@command(command="loot", params=[], description="Show the list of added items", access_level="member")
|
||||
@@ -292,9 +293,9 @@ class LootController:
|
||||
for item in items:
|
||||
self.add_item_to_loot(item, item.comment, item.multiloot)
|
||||
|
||||
self.bot.send_private_channel_message("%s table was added to loot." % category)
|
||||
self.bot.send_private_channel_message(f"{category} table was added to loot.")
|
||||
else:
|
||||
return "%s does not have any items registered in loot table." % category
|
||||
return f"{category} does not have any items registered in loot table."
|
||||
|
||||
@command(command="loot",
|
||||
params=[Const("additem", is_optional=True), Int("item"), Int("item_count", is_optional=True)],
|
||||
@@ -308,7 +309,7 @@ class LootController:
|
||||
|
||||
item = self.items_controller.get_by_item_id(item_id)
|
||||
if not item:
|
||||
return "Could not find item with ID <highlight>%d<end>." % item_id
|
||||
return f"Could not find item with ID <highlight>{item_id}<end>."
|
||||
|
||||
self.add_item_to_loot(item, item_count=item_count)
|
||||
|
||||
@@ -337,7 +338,7 @@ class LootController:
|
||||
loot += item
|
||||
self.add_item_to_loot(item, item_count=item_count)
|
||||
|
||||
self.bot.send_private_channel_message("<highlight>%s<end> was added to loot list." % loot)
|
||||
self.bot.send_private_channel_message(f"<highlight>{loot}<end> was added to loot list.")
|
||||
|
||||
@timerevent(budatime="1h",
|
||||
description="Periodically check when loot list was last modified, and clear it "
|
||||
@@ -384,10 +385,10 @@ class LootController:
|
||||
[item[0][2], item[0][3]])
|
||||
if imgid is not None:
|
||||
img = self.text.make_image(imgid.get("icon")) + " - "
|
||||
blob += "%d. %s%s " % (i, img, item[0][0])
|
||||
blob += f"{i:d}. {img}{item[0][0]} "
|
||||
|
||||
else:
|
||||
blob += "%d. %s " % (i, loot_item.get_item_str())
|
||||
blob += f"{i:d}. {loot_item.get_item_str()} "
|
||||
blob += f"x{loot_item.count} [{self.text.make_chatcmd('Add', f'/tell <myname> loot add {i}')}]\n"
|
||||
blob += " └ "
|
||||
if edit:
|
||||
|
||||
@@ -33,11 +33,11 @@ class NotesController:
|
||||
cnt += alt_cnt
|
||||
|
||||
if alt_cnt:
|
||||
blob += "\n<header2>%s</header2>\n" % alt.name
|
||||
blob += f"\n<header2>{alt.name}</header2>\n"
|
||||
for row in data:
|
||||
blob += "%s %s\n\n" % (row.note, self.text.make_tellcmd("Remove", "notes remove %d" % row.id))
|
||||
blob += f"» {row.note} {self.text.make_tellcmd('Remove', f'notes remove {row.id:d}')}\n"
|
||||
|
||||
return ChatBlob("Notes for %s (%d)" % (alts[0].name, cnt), blob)
|
||||
return ChatBlob(f"Notes for {alts[0].name} ({cnt:d})", blob)
|
||||
|
||||
@command(command="notes", params=[Const("add"), Any("note")], access_level="member",
|
||||
description="Add a note")
|
||||
@@ -56,7 +56,7 @@ class NotesController:
|
||||
[note_id])
|
||||
|
||||
if not note:
|
||||
return f"Could not find note with ID <highlight>{note_id:d}</highlight>."
|
||||
return f"Could not find note with ID <highlight>{note_id}</highlight>."
|
||||
|
||||
if self.account_service.get_main(request.sender.char_id).char_id \
|
||||
!= self.account_service.get_main(note.char_id).char_id:
|
||||
@@ -64,4 +64,4 @@ class NotesController:
|
||||
|
||||
self.db.exec("DELETE FROM notes WHERE id = ?", [note_id])
|
||||
|
||||
return f"Note with ID <highlight>{note_id:d}</highlight> deleted successfully."
|
||||
return f"Note with ID <highlight>{note_id}</highlight> deleted successfully."
|
||||
|
||||
@@ -121,15 +121,16 @@ class OnlineController:
|
||||
params = [self.bot.name, self.bot.get_char_id()]
|
||||
if not option:
|
||||
option = "prof"
|
||||
|
||||
output = ""
|
||||
if option == "prof":
|
||||
return self.online_display.count_prof(query, params, filters)
|
||||
output = self.online_display.count_prof(query, params, filters)
|
||||
elif option == "org":
|
||||
return self.online_display.count_org(query, params, filters)
|
||||
output = self.online_display.count_org(query, params, filters)
|
||||
elif option == "tl":
|
||||
if filters:
|
||||
try:
|
||||
filters = int(filters)
|
||||
except ValueError:
|
||||
return f"Invalid Title level: {filters}"
|
||||
return self.online_display.count_tl(query, params, filters)
|
||||
output = self.online_display.count_tl(query, params, filters)
|
||||
return output if output != "" else "Nobody is in my private channel, sorry..."
|
||||
|
||||
Reference in New Issue
Block a user