aboutsummaryrefslogtreecommitdiff
path: root/commands/episode.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-13 16:32:59 +0100
committerMinteck <contact@minteck.org>2022-02-13 16:32:59 +0100
commit9284ccc79f186efa34b2f8bd2543cc37c636c0b1 (patch)
tree1fd92fc5c37e577c1e01b3b5ed83e2fa7ed49f1c /commands/episode.js
parent06ea49feb4000e7e76e5960c310a73c0432ea183 (diff)
downloadponyfind-9284ccc79f186efa34b2f8bd2543cc37c636c0b1.tar.gz
ponyfind-9284ccc79f186efa34b2f8bd2543cc37c636c0b1.tar.bz2
ponyfind-9284ccc79f186efa34b2f8bd2543cc37c636c0b1.zip
Stats for episodes
Diffstat (limited to 'commands/episode.js')
-rw-r--r--commands/episode.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/episode.js b/commands/episode.js
index bf5b9f2..d6113a4 100644
--- a/commands/episode.js
+++ b/commands/episode.js
@@ -10,6 +10,13 @@ module.exports = async (interaction) => {
let select = interaction.options.getSubcommand();
let episode = interaction.options.getString('episode').toLowerCase();
+ if (statsEpisodes[select + "-" + episode] !== undefined) {
+ statsEpisodes[select + "-" + episode]++;
+ } else {
+ statsEpisodes[select + "-" + episode] = 1;
+ }
+ fs.writeFile("./stats/episodes.json", JSON.stringify(statsEpisodes), () => {});
+
let sdata = series.filter(i => i.command.toLowerCase() === select)[0];
if (typeof episode === "string") {
await episodeReply(interaction, select, episode, sdata);