Handle no messages errors

This commit is contained in:
Nexus 2024-03-19 00:46:10 +00:00
parent 328e5d3877
commit 916ba0ab42
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -145,6 +145,18 @@ class QuoteQuota(commands.Cog):
authors.setdefault(name, 0) authors.setdefault(name, 0)
authors[name] += 1 authors[name] += 1
if not authors:
if total:
return await ctx.edit(
content="No valid messages found in the last {!s} days. "
"Make sure quotes are formatted properly ending with ` - AuthorName`"
" (e.g. `\"This is my quote\" - Jimmy`)".format(days)
)
else:
return await ctx.edit(
content="No messages found in the last {!s} days.".format(days)
)
file = await asyncio.to_thread( file = await asyncio.to_thread(
self.generate_pie_chart, self.generate_pie_chart,
list(authors.keys()), list(authors.keys()),