我使用 api 来获取我的 mincraft 服务器详细信息,它给了我 ip、玩家数量和所有爵士乐,但是对于服务器图标,它给了我一个基本的 64url,所以我需要先在我的不和谐机器人中解码它,但我不确定这是怎么回事可以完成 https://www.npmjs.com/package/minecraft-server-util这是我使用的 api,如果你想看看,如果你需要查看我的代码,那么你可以告诉我如何整合它就是这样
const discord = require("discord.js");
const util = require('minecraft-server-util');
const {MessageEmbed} = require('discord.js');
const bot = new discord.Client();
const token = "my token but i removed it here for privecy reasons";
const PREFIX = "-";
var version = "1.0.1"
util.status("hypixel.net")
bot.on("ready", ()=>{
console.log("this bot is online!")
})
bot.on("message", message=>{
let args = message.content.slice(PREFIX.length).split(" ")
switch(args[0]){
case "ping":
message.reply ("pong");
break;
case "website":
message.channel.send("youtube.com/probler")
break;
case "info":
if(args[1] === "version"){
message.channel.send("We Are Curently In Version " + version)
}
else{
message.channel.send("Invalid Command")
}
break;
case "clear":
if(!args[1]) return message.reply("Error Please Define A Number")
message.channel.bulkDelete(args[1]);
break;
case "embed":
const embed = new MessageEmbed()
.setColor('RANDOM')
.setTitle("User Information")
.addField("Player Name", message.author.username, true)
.addField("Current Server", message.guild.name,)
.setThumbnail(message.author.displayAvatarURL())
.setFooter("Version " + version)
message.channel.send(embed);
break;
case 'mc':
const util = require('minecraft-server-util');
util.status(args[1])
.then ((response) => {
const embed = new MessageEmbed()
.setColor("RANDOM")
.setTitle('__Server Status__')
.addField('Server IP', response.host)
.addField('Server Version', response.version)
.addField('Online Players', response.onlinePlayers)
.addField('Max Players', response.maxPlayers)
.setThumbnail("Server Icon", response.favicon)
message.channel.send(embed)
})
.catch((error, response) => {
throw error;
});
break;
}
}
)
bot.login(token);```