diff options
author | Minteck <contact@minteck.org> | 2022-02-13 16:16:18 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-02-13 16:16:18 +0100 |
commit | 327119b4d1c2248b8a075cad3cd05ab92560e75d (patch) | |
tree | ce143399e74c120f7311e75490efd0defd9b58d8 /modules/registers.js | |
parent | ede8d0750f3f16e3ba5c3c3f716c98d267512b09 (diff) | |
download | ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.gz ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.tar.bz2 ponyfind-327119b4d1c2248b8a075cad3cd05ab92560e75d.zip |
Feature: implements #8, voids #9
Diffstat (limited to 'modules/registers.js')
-rw-r--r-- | modules/registers.js | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/modules/registers.js b/modules/registers.js index 7bf2b68..59ed699 100644 --- a/modules/registers.js +++ b/modules/registers.js @@ -1,4 +1,22 @@ -const { SlashCommandBuilder } = require('@discordjs/builders'); +const { SlashCommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandBuilder } = require('@discordjs/builders'); +const fs = require('fs'); + +let episodesCmd = new SlashCommandBuilder() + .setName("episode") + .setDescription("Gets info about a series' episode") + +for (let series of JSON.parse(fs.readFileSync("./data/series.json").toString())) { + let command = new SlashCommandSubcommandBuilder() + .setName(series.command.toLowerCase()) + .setDescription(series.title + " (" + series.date + ")") + .addStringOption(s => + s.setName("episode") + .setDescription("The episode to search for") + .setAutocomplete(true) + ) + + episodesCmd.addSubcommand(command) +} module.exports = [ new SlashCommandBuilder() @@ -18,16 +36,7 @@ module.exports = [ new SlashCommandBuilder() .setName('random') .setDescription("Picks a random pony"), - // new SlashCommandBuilder() - // .setName('lang') - // .setDescription("Changes the bot's language") - // .addStringOption(option => - // option.setName('locale') - // .setDescription('The selected language') - // .setRequired(true) - // .addChoice('Français', 'fr') - // .addChoice('English', 'en') - // ), + episodesCmd, new SlashCommandBuilder() .setName('config') .setDescription("Configure all aspects of the bot") @@ -65,16 +74,5 @@ module.exports = [ .addChoice('English', 'en') .addChoice('User prefered language (default)', 'off') ) - ), - // new SlashCommandBuilder() - // .setName('serverlang') - // .setDescription("Changes the bot's language on this server") - // .addStringOption(option => - // option.setName('locale') - // .setDescription('The selected language') - // .setRequired(true) - // .addChoice('Français', 'fr') - // .addChoice('English', 'en') - // .addChoice('User prefered language (default)', 'off') - // ) + ) ]
\ No newline at end of file |