Updating scripts and removing useless commands

This commit is contained in:
2023-08-30 11:03:03 +02:00
parent bbf6fed93e
commit 1977287abb
5 changed files with 43 additions and 45 deletions

1
.gitignore vendored
View File

@@ -2,4 +2,3 @@ node_modules/*
.env .env
.prettierrc .prettierrc
.editorconfig .editorconfig
dev-deploy.js

View File

@@ -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',
},
}]
});
}
}

View File

@@ -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
View 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);
}
})();