parent
0a8df28a94
commit
3d674f12e0
1 changed files with 13 additions and 9 deletions
|
@ -6,7 +6,7 @@ const { EmbedBuilder } = require('discord.js');
|
|||
|
||||
module.exports = {
|
||||
name: 'mc', // Keep it to one word
|
||||
description: 'get mc server info from lazy duchess server',
|
||||
description: 'get minecraft server information',
|
||||
hidden: true,
|
||||
whitelist: true,
|
||||
async execute({ message, args }) {
|
||||
|
@ -21,16 +21,20 @@ module.exports = {
|
|||
if(host === "") return message.channel.send("No host provided")
|
||||
let info = await getMinecraftServerInfo(host, port);
|
||||
if (info) {
|
||||
console.log(info)
|
||||
let descriptionArr = [
|
||||
`Ping: ${info.ping.toString()}`,
|
||||
`Player Count: ${info.playercount}`,
|
||||
`Max Players: ${info.maxPlayers}`,
|
||||
`MOTD: ${info.motd}`
|
||||
]
|
||||
let description = "";
|
||||
descriptionArr.forEach(desc => {
|
||||
description += `${desc}\n`;
|
||||
})
|
||||
const embed = new EmbedBuilder()
|
||||
embed.setColor("#ee7939")
|
||||
embed.setTimestamp()
|
||||
embed.addFields([
|
||||
{ name: "ping", value: info.ping.toString(), inline: false },
|
||||
{ name: "Player Count", value: info.playercount, inline: false },
|
||||
{ name: "Max Players", value: info.maxPlayers, inline: false },
|
||||
{ name: "MOTD", value: info.motd, inline: false },
|
||||
])
|
||||
embed.setDescription(description)
|
||||
|
||||
message.channel.send({ embeds: [embed] });
|
||||
} else {
|
||||
|
@ -101,4 +105,4 @@ async function getMinecraftServerInfo(host, port = 25565) {
|
|||
})
|
||||
})
|
||||
return serverInfo
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue