A Discord Bot connected to your Pterodactyl API.
at main 33 lines 943 B view raw
1import { SlashCommandBuilder } from "discord.js"; 2import axios from "axios"; 3 4export default { 5 data: new SlashCommandBuilder() 6 .setName("send") 7 .setDescription("Send a command to your server") 8 .addStringOption((option) => 9 option.setName("identifier") 10 .setDescription("Your server identifier") 11 .setRequired(true), 12 ) 13 .addStringOption((option) => 14 option.setName("command") 15 .setDescription("Command you want to send on the server") 16 .setRequired(true), 17 ), 18 async execute(interaction) { 19 const id = interaction.options.get("identifier").value; 20 const command = interaction.options.get("command").value; 21 try { 22 await axios.post(`/servers/${id}/command`, { 23 "command": command, 24 }); 25 } 26 catch (error) { 27 console.log(error); 28 } 29 30 // TODO: Reply what's return in the server's console in an embed code message 31 return interaction.reply("Your command has been send to the server successfully"); 32 }, 33};