Add boilerplate
This commit is contained in:
22
registerCommands.js
Normal file
22
registerCommands.js
Normal file
@@ -0,0 +1,22 @@
|
||||
'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();
|
||||
}
|
||||
Reference in New Issue
Block a user