Add quote list subcommand
This commit is contained in:
19
bot.py
19
bot.py
@@ -261,6 +261,25 @@ async def quote_command(ctx: commands.Context, author: Optional[str], *, quote:
|
||||
await ctx.channel.send(quote + '\n *~' + author + '*')
|
||||
else:
|
||||
await ctx.channel.send("No quotes present!")
|
||||
elif author == 'list':
|
||||
def create_list_embed(quote_author: str, _quotes: List[str]) -> discord.Embed:
|
||||
embed: discord.Embed = discord.Embed(
|
||||
title=quote_author,
|
||||
description='\n'.join(_quotes)
|
||||
)
|
||||
return embed
|
||||
|
||||
if quote is None:
|
||||
coroutines = []
|
||||
for author, author_quotes in quotes.items():
|
||||
coroutines.append(ctx.send(embed=create_list_embed(author, author_quotes)))
|
||||
await asyncio.gather(*coroutines)
|
||||
else:
|
||||
author = quote.strip().title()
|
||||
if author in quotes:
|
||||
await ctx.send(embed=create_list_embed(author, quotes[author]))
|
||||
else:
|
||||
await ctx.send("No such author!")
|
||||
else:
|
||||
author = author.strip().title()
|
||||
if quote:
|
||||
|
||||
Reference in New Issue
Block a user