From 767dac7843d86b14d7403c32ca71fbdea9d52ce3 Mon Sep 17 00:00:00 2001 From: Blobby Date: Sun, 14 Jan 2024 11:13:26 +0400 Subject: [PATCH] Delete mc-serverinfo.js --- mc-serverinfo.js | 52 ------------------------------------------------ 1 file changed, 52 deletions(-) delete mode 100644 mc-serverinfo.js diff --git a/mc-serverinfo.js b/mc-serverinfo.js deleted file mode 100644 index d249978..0000000 --- a/mc-serverinfo.js +++ /dev/null @@ -1,52 +0,0 @@ -const { Client, Interaction, ApplicationCommandOptionType, EmbedBuilder } = require('discord.js'); - -module.exports = { - /** - * - * @param {Client} client - * @param {Interaction} interaction - */ - callback: async (client, interaction) => { - await interaction.deferReply(); - - const ip = interaction.options.getString('ip'); - - try { - var apiData = await fetch(`https://mcapi.us/server/status?ip=${ip}`); - var mc = await apiData.json(); - - if (mc.status == 'error') { - await interaction.editReply({ content: 'Either the server is offline or non-existent.', ephemeral: true }); - } - - if (mc.status == 'success') { - const embed = new EmbedBuilder() - .setTitle('Minecraft Server Information') - .addFields( - { name: 'Description', value: `${mc.motd}` || '`None`', inline: false}, - { name: 'IP', value: `${ip.toLowerCase()}`, inline: true }, - { name: 'Version Required', value: `${mc.server.name}`, inline: true }, - { name: 'Server Protocol', value: `${mc.server.protocol}`, inline: true}, - ) - .setImage(`https://mcapi.us/server/image?ip=${ip}&theme=dark`) - .setTimestamp(); - - await interaction.editReply({ embeds: [embed] }); - } - } catch (error) { - console.error('Error fetching Minecraft server information:', error); - await interaction.editReply({ content: 'An error occurred while fetching server information.', ephemeral: true }); - } - }, - - name: 'mc-serverinfo', - description: 'Provides information of a Minecraft server', - options: [ - { - name: 'ip', - description: 'IP / server address', - type: ApplicationCommandOptionType.String, - required: true, - }, - ], -}; \ No newline at end of file