A Discord Bot connected to your Pterodactyl API.
0
fork

Configure Feed

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

fix: api error and lint

authored by

cosmeak and committed by
Cosmeak
1594a1f3 e61e1ec7

+27 -12
+3 -3
src/commands/ClientServerList.js
··· 16 16 17 17 let message = ""; 18 18 response.data.data.forEach((server) => { 19 - message += server.attributes.name + " [" + server.attributes.identifier + "] \n"; 19 + message += `**${server.attributes.name}** [${server.attributes.identifier}]\n\n`; 20 20 }); 21 21 22 22 const embed = new EmbedBuilder() 23 - .setTitle("All available servers") 23 + .setTitle("Your servers") 24 24 .setDescription(message) 25 25 .setColor("Blurple") 26 - .setTitle(); 26 + .setTimestamp(); 27 27 28 28 return interaction.reply({ embeds: [embed] }); 29 29 },
+1 -1
src/commands/ClientServerPower.js
··· 9 9 .setDescription("Provide a way to up or down a server") 10 10 .addStringOption((option) => 11 11 option.setName("server-id") 12 - .setDescription("Your server external_ID") 12 + .setDescription("Your server identifier") 13 13 .setRequired(true), 14 14 ) 15 15 .addStringOption((option) =>
+6 -6
src/functions/bytesToSize.js
··· 1 1 module.exports = (bytes) => { 2 - const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] 3 - if (bytes === 0) return 'n/a' 4 - const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10) 5 - if (i === 0) return `${bytes} ${sizes[i]})` 6 - return `${(bytes / (1024 ** i)).toFixed(1)} ${sizes[i]}` 7 - } 2 + const sizes = ["Bytes", "KB", "MB", "GB", "TB"]; 3 + if (bytes === 0) return "n/a"; 4 + const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10); 5 + if (i === 0) return `${bytes} ${sizes[i]})`; 6 + return `${(bytes / (1024 ** i)).toFixed(1)} ${sizes[i]}`; 7 + };
+2 -2
src/functions/capitalizeFirstLetter.js
··· 1 1 module.exports = (string) => { 2 - return string.charAt(0).toUpperCase() + string.slice(1); 3 - } 2 + return string.charAt(0).toUpperCase() + string.slice(1); 3 + };
+15
src/functions/postServerPower.js
··· 1 + const axios = require("axios"); 2 + require("dotenv").config(); 3 + 4 + module.exports = async (id, signal) => { 5 + return await axios.post(`${process.env.PTERO_HOST}/api/client/servers/${id}/power`, { 6 + "headers": { 7 + "Accept": "application/json", 8 + "Content-Type": "application/json", 9 + "Authorization": `Bearer ${process.env.PTERO_TOKEN}`, 10 + }, 11 + "body": { 12 + "signal": signal, 13 + }, 14 + }); 15 + };