A Discord Bot connected to your Pterodactyl API.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: create a backup

authored by

cosmeak and committed by
Cosmeak
b9649615 e6f75581

+15 -14
+13 -12
src/commands/CreateBackup.js
··· 1 - import { SlashCommandBuilder, EmbedBuilder } from "discord.js"; 2 - import fecthClientServerInfo from "../functions/fetchClientServerInfo.js"; 3 - // import axios from "axios"; 1 + import { SlashCommandBuilder } from "discord.js"; 2 + import axios from "axios"; 4 3 5 4 export default { 6 5 data: new SlashCommandBuilder() 7 6 .setName("create-backup") 8 7 .setDescription("Create a new backup for a server") 9 8 .addStringOption((option) => 10 - option.setName("server-id") 9 + option.setName("identifier") 11 10 .setDescription("Your server identifier") 12 11 .setRequired(true), 13 12 ), 14 13 async execute(interaction) { 15 - const serverId = interaction.options.get("server-id").value; 16 - const server = await fecthClientServerInfo(serverId); 17 - const embed = new EmbedBuilder() 18 - .setTitle(`Server: ${server.name}`) 19 - .setDescription("New embed for a serve") 20 - .setColor("Blurple") 21 - .setTimestamp(); 14 + const id = interaction.options.get("identifier").value; 15 + let response; 16 + try { 17 + response = await axios.post(`/servers/${id}/backups`); 18 + } 19 + catch (error) { 20 + console.log(error.response.data.errors); 21 + return interaction.reply({ content: error.response.data.errors[0].detail, ephemeral: true }); 22 + } 22 23 23 - return interaction.reply({ embeds: [embed] }); 24 + return interaction.reply(`Backup created successfuly with the name ${response.data.attributes.name}`); 24 25 }, 25 26 };
+2 -2
src/commands/Help.js
··· 8 8 const embed = new EmbedBuilder() 9 9 .setTitle("Need some help?") 10 10 .setDescription(` 11 - **PteroBot** give an access to control your server trough this discord commands. \n 11 + **PteroBot** give an access to control your server trough discord commands. \n 12 12 **/servers** : List all your servers \n 13 13 **/server {identifier}** : Show you informations about your server, like CPU, RAM, DISK utilization or Update \n 14 14 **/power {identifer} {state}** : Provide you a way to change a server state (start, stop, kill or restart) \n 15 15 **/backups {identifier}** : Show all your server backups \n 16 16 **/create-backup {identifier}** : Create a new backup for your (within the limit of available backups) \n 17 17 \n 18 - If you want to support the bot development, please stared the github repository or contribute to it. https://github.com/Cosmeak/PteroBot 18 + If you want to support bot development, please stars the github repository or contribute to it. https://github.com/Cosmeak/PteroBot 19 19 `) 20 20 .setTimestamp() 21 21 .setColor("Blurple");
src/functions/loadFilesFromFolder.js

This is a binary file and will not be displayed.