Updating scripts and removing useless commands
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,3 @@ node_modules/*
|
|||||||
.env
|
.env
|
||||||
.prettierrc
|
.prettierrc
|
||||||
.editorconfig
|
.editorconfig
|
||||||
dev-deploy.js
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
name: 'maketestembed',
|
|
||||||
description: 'Make a test embed',
|
|
||||||
type: 'slash',
|
|
||||||
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('maketestembed')
|
|
||||||
.setDescription('Make a test embed')
|
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
|
|
||||||
|
|
||||||
async execute(interaction) {
|
|
||||||
|
|
||||||
await interaction.reply({
|
|
||||||
embeds: [{
|
|
||||||
title: 'Test Embed',
|
|
||||||
description: 'This is a test embed',
|
|
||||||
color: 0xff0000,
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'Field 1',
|
|
||||||
value: 'This is field 1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Field 2',
|
|
||||||
value: 'This is field 2',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Field 3',
|
|
||||||
value: 'This is field 3',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
footer: {
|
|
||||||
text: 'This is a test embed',
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,8 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prod:build": "node deploy-commands.js --prod",
|
"prod:build": "node scripts/deploy-commands.js --prod",
|
||||||
"prod:build:context": "node deploy-commands.js --contextmenu",
|
"dev:build": "node scripts/deploy-commands.js --dev"
|
||||||
"dev:build": "node deploy-commands.js --dev"
|
|
||||||
},
|
},
|
||||||
"author": "Taken",
|
"author": "Taken",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
41
scripts/dev-deploy.js
Normal file
41
scripts/dev-deploy.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const { REST, Routes } = require('discord.js');
|
||||||
|
const env = require('dotenv').config();
|
||||||
|
const token = process.env.TOKEN;
|
||||||
|
const clientId = process.env.DEVID;
|
||||||
|
const guildId = process.env.GUILDID;
|
||||||
|
|
||||||
|
const commands = [];
|
||||||
|
// Grab all the command files from the commands directory you created earlier
|
||||||
|
// const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
|
const commandFiles = [
|
||||||
|
'./commands/config.js',
|
||||||
|
]
|
||||||
|
|
||||||
|
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
|
||||||
|
for (const file of commandFiles) {
|
||||||
|
const command = require(`${file}`);
|
||||||
|
commands.push(command.data.toJSON());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct and prepare an instance of the REST module
|
||||||
|
const rest = new REST({ version: '10' }).setToken(token);
|
||||||
|
|
||||||
|
|
||||||
|
// and deploy your commands!
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
console.log(`Started refreshing ${commands.length} application (/) commands.`);
|
||||||
|
|
||||||
|
// The put method is used to fully refresh all commands in the guild with the current set
|
||||||
|
const data = await rest.put(
|
||||||
|
Routes.applicationGuildCommands(clientId, guildId),
|
||||||
|
{ body: commands },
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
|
||||||
|
} catch (error) {
|
||||||
|
// And of course, make sure you catch and log any errors!
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
})();
|
||||||
Reference in New Issue
Block a user