···66 .setName("power")
77 .setDescription("Provide a way to up or down a server")
88 .addStringOption((option) =>
99- option.setName("server-id")
99+ option.setName("identifier")
1010 .setDescription("Your server identifier")
1111 .setRequired(true),
1212 )
···2323 ),
2424 async execute(interaction) {
2525 const state = interaction.options.get("state").value;
2626- const id = interaction.options.get("server-id").value;
2727-2626+ const id = interaction.options.get("identifier").value;
2827 try {
2928 await postServerPower(id, state);
3029 }
3130 catch (error) {
3231 return interaction.reply({ content: error, ephemeral: true });
3332 }
3434-3533 return interaction.reply(`**${state}** request as been sent to the server with success!`);
3634 },
3735};
+21-4
src/commands/SendCommand.js
···11import { SlashCommandBuilder } from "discord.js";
22-// import axios from "axios";
33-// import { config } from "dotenv";
44-// config();
22+import axios from "axios";
33+import { config } from "dotenv";
44+config();
5566export default {
77 data: new SlashCommandBuilder()
88 .setName("send")
99 .setDescription("Send a command to your server")
1010 .addStringOption((option) =>
1111- option.setName("server-id")
1111+ option.setName("identifier")
1212 .setDescription("Your server identifier")
1313+ .setRequired(true),
1414+ )
1515+ .addStringOption((option) =>
1616+ option.setName("command")
1717+ .setDescription("Command you want to send on the server")
1318 .setRequired(true),
1419 ),
1520 async execute(interaction) {
2121+ const id = interaction.options.get("identifier").value;
2222+ const command = interaction.options.get("command").value;
2323+ try {
2424+ await axios.post(`/servers/${id}/command`, {
2525+ "command": command,
2626+ });
2727+ }
2828+ catch (error) {
2929+ console.log(error);
3030+ }
16313232+ // TODO: Reply what's return in the server's console in an embed code message
3333+ return interaction.reply("Your command has been send to the server successfully");
1734 },
1835};