aboutsummaryrefslogtreecommitdiff
path: root/handler/autocomplete.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-02-13 16:16:18 +0100
committerMinteck <contact@minteck.org>2022-02-13 16:16:18 +0100
commit327119b4d1c2248b8a075cad3cd05ab92560e75d (patch)
treece143399e74c120f7311e75490efd0defd9b58d8 /handler/autocomplete.js
parentede8d0750f3f16e3ba5c3c3f716c98d267512b09 (diff)
downloadponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.gz
ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.bz2
ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.zip
Feature: implements #8, voids #9
Diffstat (limited to 'handler/autocomplete.js')
-rw-r--r--handler/autocomplete.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/handler/autocomplete.js b/handler/autocomplete.js
new file mode 100644
index 0000000..5696ab7
--- /dev/null
+++ b/handler/autocomplete.js
@@ -0,0 +1,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) {}
+} \ No newline at end of file