我使用 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;
})
.catch((error, response) => {
throw error;
});
break;
}
}
)
智慧大石
相关分类