This is a client library for the public Hypixel API.
const Hypixel = require('hypixel');
const client = new Hypixel({ key: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' });
// old school callbacks
client.getPlayerByUsername('PxlPanda', (err, player) => {
if (err) {
return console.info('Nope!');
}
// or a Promise if no callback provided
client.findGuildByPlayer(player.uuid)
.then((guildId) => {
...
})
.catch((err) => {
...
});
});
npm install hypixel
When querying data by player UUIDs make sure to remove dashes.
const Hypixel = require('hypixel');
const client = new Hypixel({ key: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' });
client.getKeyInfo((err, info) => { ... });
client.findGuildByName(name, (err, guildId) => { ... });
client.findGuildByPlayer(playerUuid, (err, guildId) => { ... });
client.getGuild(guildId, (err, guild) => { ... });
client.getBoosters((err, boosters) => { ... });
client.getFriends(playerUuidOrUsername, (err, friends) => { ... });
client.getSession(playerUuidOrUsername, (err, sessionId) => { ... });
client.getPlayer(playerUuid, (err, player) => { ... });
client.getPlayerByUsername(username, (err, player) => { ... });