diff options
author | Minteck <contact@minteck.org> | 2022-02-10 23:17:10 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-02-10 23:17:10 +0100 |
commit | 11995e8d8d4c97e5c17bf11d8238f42ea269dd26 (patch) | |
tree | b0225886782c701f701b2b1f8e136d2de69d66bb /commands | |
parent | 38a17a51fd082c0f893e4d9f8a99330b073a2ade (diff) | |
download | ponyfind-11995e8d8d4c97e5c17bf11d8238f42ea269dd26.tar.gz ponyfind-11995e8d8d4c97e5c17bf11d8238f42ea269dd26.tar.bz2 ponyfind-11995e8d8d4c97e5c17bf11d8238f42ea269dd26.zip |
Feature: add many statistics (#3)
Diffstat (limited to 'commands')
-rw-r--r-- | commands/pony.js | 10 |
1 files changed, 9 insertions, 1 deletions
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) { |