aboutsummaryrefslogtreecommitdiff
path: root/handler/autocomplete.js
blob: 5696ab703234cb2d34a7f5abe4f0931b262b6d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const getEpisodes = require('../modules/findepisode');
const fs = require("fs");
const episodes = JSON.parse(fs.readFileSync("./data/series.json").toString());

module.exports = async (interaction) => {
    try {
        let series = interaction.options.getSubcommand();

        if (interaction.commandName === "episode") {
            await interaction.respond(getEpisodes(episodes.filter(i => i.command.toLowerCase() === series)[0], interaction.options.getFocused()));
        }
    } catch (e) {}
}