blob: d6113a42dee68791c5421264aa4856edc58f37b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const fs = require('fs');
const { MessageActionRow, MessageButton, MessageSelectMenu, MessageEmbed } = require('discord.js');
const getEpisodePublic = require("../modules/episodepublic");
const episodeReply = require("../modules/episodereply");
const series = JSON.parse(fs.readFileSync("./data/series.json").toString());
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);
}
}
|