'use strict'; const path = require('path'); const { Routes } = require('discord.js'); const { REST } = require('@discordjs/rest'); const config = require(path.join(__dirname, 'config', 'config.json')); const getCommands = require(path.join(__dirname, 'lib', 'getCommands.js')); module.exports = () => { const commands = getCommands().map(({ data }) => data.toJSON()); const rest = new REST({ version: '10' }).setToken(config.clientToken); return rest.put(Routes.applicationCommands(config.clientId), { body: commands }); }; if (require.main === module) { console.log(getCommands()); module.exports(); }