ADD/CHG: 'qinfo' command now accepts 'last' as parameter

pull/3/head
Kamal Curi 2 years ago
parent 82605eee5b
commit 7873903634

@ -76,10 +76,12 @@ async def random_quote(bot: object) -> str:
'`--q <quote`)')
quote_id_stack.append(chosen_one.id)
if stack_len >= stack_limit:
quote_id_stack.pop(0)
global last_quote
last_quote = int(chosen_one.id)
# Writes to persistent stackfile
with open(QUOTE_STACK, mode='w') as f:
json.dump(quote_id_stack, f)
@ -121,7 +123,7 @@ async def by_id(bot: object, _id: int=None) -> str:
@client.command(aliases=['qinfo'])
async def quote_info(bot: object, _id: int=None) -> str:
async def quote_info(bot: object, _id: str=None) -> str:
"""
Prints out information about a quote
"""
@ -131,7 +133,10 @@ async def quote_info(bot: object, _id: int=None) -> str:
return await bot.send("_If you don't tell me the ID, how the fuck do you expect me to "\
f"get its info for you!?_\n(The correct syntax is {syntax})")
quote = get_by_id(_id)
if _id == "last":
_id = quote_id_stack[-1]
quote = get_by_id(int(_id))
if not quote:
return await bot.send(f"_Wrong ID, sucker!_\n(There's no such quote with id {_id})")
@ -431,4 +436,4 @@ async def neeble_debug(bot:object) -> str:
qt_count = count_quotes()
st_size = len(quote_id_stack)
return await bot.send(f"```\nqt_count:{qt_count}\nst_size:{st_size}\nst_limit{stack_limit}\n```")
return await bot.send(f"```\nqt_count:{qt_count}\nst_size:{st_size}\nst_limit:{stack_limit}\nlst_qt:{last_quote}\n```")
Loading…
Cancel
Save