diff options
-rw-r--r-- | commands/pony.js | 6 | ||||
-rw-r--r-- | handler/button.js | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/commands/pony.js b/commands/pony.js index 1cd6006..4654b12 100644 --- a/commands/pony.js +++ b/commands/pony.js @@ -26,6 +26,12 @@ module.exports = async (interaction) => { fs.writeFile("./stats/queries.json", JSON.stringify(statsQueries), () => {}); if (result.results[0].toLowerCase().trim() === query.toLowerCase().trim()) { keys = [null, result.results[0]]; + if (statsPonies[keys[1]] !== undefined) { + statsPonies[keys[1]]++; + } else { + statsPonies[keys[1]] = 1; + } + fs.writeFile("./stats/ponies.json", JSON.stringify(statsPonies), () => {}); if (interaction.guild) { row = new MessageActionRow() .addComponents( diff --git a/handler/button.js b/handler/button.js index 7f5893f..c5cfb19 100644 --- a/handler/button.js +++ b/handler/button.js @@ -17,6 +17,12 @@ module.exports = async (interaction) => { if (keys[0] === "pony.display") {
let row;
+ if (statsPonies[keys[1]] !== undefined) {
+ statsPonies[keys[1]]++;
+ } else {
+ statsPonies[keys[1]] = 1;
+ }
+ fs.writeFile("./stats/ponies.json", JSON.stringify(statsPonies), () => {});
if (interaction.guild) {
row = new MessageActionRow()
.addComponents(
|