diff --git a/src/commands/quotes.command.ts b/src/commands/quotes.command.ts index 8e335d3..3415ac5 100644 --- a/src/commands/quotes.command.ts +++ b/src/commands/quotes.command.ts @@ -26,6 +26,7 @@ export default command({ '`!quote` - Get a random quote', '`!quote ` - Get a specific quote', '`!quote search ` - Search for a quote', + '`!quote count` - See how many quotes have been stored so far!', '`!quote add @author ` - Add a new quote (@author can be a user mention, a plain nickname, or left out)', '`!quote remove ` - Remove quote - You can only remove quotes you created to reduce abuse.', ], @@ -53,6 +54,13 @@ export default command({ case 'search': searchQuotes(message, args.slice(1)) return + + // Get quote count + case 'count': + await countQuotes(message) + return + + // Get single quote default: if (first.startsWith('#')) { getSingleQuote(message, args[0].substring(1)) @@ -74,6 +82,11 @@ const getQuoteStr = ( return `**"${quote}"** - ${authorMention} (ID: #${uid})` } +async function countQuotes(message: Discord.Message) { + const count = await collection.countDocuments() + message.reply(`There are ${count} quotes stored.`) +} + async function getRandomQuote(message: Discord.Message, _args: string[]): Promise { const count = await collection.countDocuments() const r = Math.floor(Math.random() * count)