embed
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require('discord.js'); // Make sure this import is correct
const axios = require('axios');
module.exports = {
data: new SlashCommandBuilder()
.setName('nodeping')
.setDescription('Ping the nodes to check their status.'),
async execute(interaction) {
try {
const response = await axios.get('https://panel.nauticalmc.net/api/application/nodes', {
headers: {
Authorization: 'Bearer no api key for y',
'Content-Type': 'application/json'
}
});
if (response.status === 200) {
const nodes = response.data.data;
const onlineNodes = nodes.filter(node => node.attributes.is_online);
const embed = new MessageEmbed()
.setTitle('Node Status')
.setDescription(onlineNodes.length > 0 ? 'Some nodes are online!' : 'No nodes are online!')
.setColor(onlineNodes.length > 0 ? 'GREEN' : 'RED');
onlineNodes.forEach(node => {
embed.addField('Online Node', node.attributes.name);
});
await interaction.reply({ embeds: [embed] });
} else {
await interaction.reply('Failed to ping the nodes.');
}
} catch (error) {
console.error('Error pinging the nodes:', error);
await interaction.reply('Error pinging the nodes.');
}
},
};const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require('discord.js'); // Make sure this import is correct
const axios = require('axios');
module.exports = {
data: new SlashCommandBuilder()
.setName('nodeping')
.setDescription('Ping the nodes to check their status.'),
async execute(interaction) {
try {
const response = await axios.get('https://panel.nauticalmc.net/api/application/nodes', {
headers: {
Authorization: 'Bearer no api key for y',
'Content-Type': 'application/json'
}
});
if (response.status === 200) {
const nodes = response.data.data;
const onlineNodes = nodes.filter(node => node.attributes.is_online);
const embed = new MessageEmbed()
.setTitle('Node Status')
.setDescription(onlineNodes.length > 0 ? 'Some nodes are online!' : 'No nodes are online!')
.setColor(onlineNodes.length > 0 ? 'GREEN' : 'RED');
onlineNodes.forEach(node => {
embed.addField('Online Node', node.attributes.name);
});
await interaction.reply({ embeds: [embed] });
} else {
await interaction.reply('Failed to ping the nodes.');
}
} catch (error) {
console.error('Error pinging the nodes:', error);
await interaction.reply('Error pinging the nodes.');
}
},
};Error pinging the nodes: TypeError: MessageEmbed is not a constructor
at Object.execute (/home/container/commands/server/nodepinger.js:23:31)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.execute (/home/container/events/interactionCreate.jjs4)