From 11995e8d8d4c97e5c17bf11d8238f42ea269dd26 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 10 Feb 2022 23:17:10 +0100 Subject: Feature: add many statistics (#3) --- commands/pony.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'commands/pony.js') diff --git a/commands/pony.js b/commands/pony.js index f15e732..1cd6006 100644 --- a/commands/pony.js +++ b/commands/pony.js @@ -12,10 +12,18 @@ const official = fs.readFileSync("./config/official.txt").toString().replace(/\r const fpserver = fs.readFileSync("./config/fpserver.txt").toString().trim(); module.exports = async (interaction) => { - query = interaction.options.getString('query'); + query = interaction.options.getString('query').toLowerCase(); result = getResult(query); if (result.results.length > 0 && getEmbed(result.results[0], interaction.user.id, interaction.guild ? interaction.guild.id : 0) !== false) { + if (statsQueries[result.results[0]] !== undefined) { + if (!statsQueries[result.results[0]].includes(query)) { + statsQueries[result.results[0]].push(query); + } + } else { + statsQueries[result.results[0]] = [ query ]; + } + fs.writeFile("./stats/queries.json", JSON.stringify(statsQueries), () => {}); if (result.results[0].toLowerCase().trim() === query.toLowerCase().trim()) { keys = [null, result.results[0]]; if (interaction.guild) { -- cgit