1.0.1 • Published 5 years ago

hypixeljs-api v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

hypixeljs-api

A lightweight Hypixel API wrapper written in Javascript.

GitHub | NPM

Installation

npm install hypixeljs-api

Usage

To start, you need to set the API key you want to use.

const HypixelJS = require('hypixeljs-api')

const client = new HypixelJS('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')

All Methods

fetchUser()

Fetches a user

client.fetchUser(type, user).then((data) => {
	console.log(data)
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

Replace type with either uuid or name. UUID standing for a player UUID and name standing for a player name. Replace user with the argument you want to search with. If type is UUID, set user as the player UUID. If type is name, set user as the player name.

Example usage

client.fetchUser(name, "53P").then((data) => {
    console.log(data) /**
    {
   "success":true,
   "player":{
      "_id":"5a10d5083564358547e06338",
      "uuid":"f429e930ca1c47beb9eca88185c69080",
      "firstLogin":1511052552441,
      "playername":"53p",
      "lastLogin":1593799593823,
      "displayname":"53P"
      ...
      }
      }*/
    console.log(data.guild.created) // 1404921815102
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

fetchGuild()

Fetches a guild

client.fetchGuild(type, guild).then((data) => {
	console.log(data)
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

Replace type with either uuid, name, or id. UUID standing for a player UUID, name standing for a guild name, and ID standing for a guild ID. Replace guild with the argument you want to search with. If type is UUID, set guild as the player UUID. If type is name, set guild as the guild name. If type is ID, set guild as the guild ID.

Example usage

client.fetchGuild(name, "Rebel").then((data) => {
    console.log(data) /**
    {
   "success":true,
   "guild":{
      "_id":"53bd67d7ed503e868873eceb",
      "coins":24038210,
      "coinsEver":26498180,
      "created":1404921815102
      ...
      }
      }*/
    console.log(data.guild.created) // 1404921815102
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

skyblockNews()

Fetches Skyblock News

client.skyblockNews().then((data) => {
	console.log(data) 
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

Example usage

client.skyblockNews().then((data) => {
    console.log(data) /**
    {
   "success":true,
   "items":[
      {
         "item":{
            "material":"ANVIL"
         },
         "link":"https://hypixel.net/threads/3064970/",
         "text":"1st July 2020",
         "title":"SkyBlock v0.7.11"
      }
      ...
    ]
   }*/
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

userBwStats()

Fetches a user's bedwars stats

client.userBwStats(type, user).then((data) => {
	console.log(data)
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

Replace type with either uuid, or name. UUID standing for a player UUID and name standing for a player name. Replace user with the argument you want to search with. If type is UUID, set user as the player UUID. If type is name, set user as the player name.

Example usage

client.userBwStats(name, "53P").then((data) => {
    console.log(data) /**
    {
    "games_played_bedwars_1":1213,
    "winstreak":1,
    "quickjoin_uses_Invasion":11,
    "quickjoin_uses_total":248,
    "first_join_7":true,
    ...
    }*/
    console.log(data.games_played_bedwars_1) // 1213
}).catch((err) => {
	console.error('An error has occured: ' + err)
})

More methods are currently being added.

If you find any bugs, please open an issue on this GitHub page: https://github.com/53P/hypixeljs-api/issues

1.0.1

5 years ago

1.0.0

5 years ago