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:
@@ -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