GithubHelp home page GithubHelp logo

cyberflamego / hypixel.js Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 23 KB

Easy to use, Hypixel JavaScript Library

Home Page: https://www.npmjs.com/package/hypixel-javascript

License: Other

JavaScript 100.00%

hypixel.js's Introduction

hypixel-javascript

About:

hypixel-javascript is a new and powerful Hypixel Node.js module to interact with Hypixel.

  • 100% coverage of the Hypixel API.
  • Adapt inputs and methods and converts whenever possible.
  • Helpful addons that reduce your workload.
  • Ultra lightweight using minimal dependencies.

Support & Bug Reporting:

hypixel-javascript is a new module created by CactiveNetwork, you can get support on your code, report any issues and more by joining the discord at discord.gg/NeqVuSy.

Installation & Usage:

In your project run npm install hypixel-javascript.

Next enter the following in your main file (index.js by default).

const Hypixel = require('hypixel-javascript');
const client = new Hypixel.Client("YOUR_API_KEY");

You need a Hypixel API key in order to use this library, join mc.hypixel.net and run /api new to get one.

Example Usage:

const Hypixel = require('hypixel-javascript');
const client = new Hypixel.Client("YOUR_API_KEY"); // API Key

client.getPlayer('caykie') // Get player automatically
    .then(console.log);

// or you can do;

(async () => {
    const data = await client.getPlayer('caykie');
    console.log(data.player);
})();

Queries:

General:

Fetch Player Data:

For this method, you can specify a username or UUID as the username will automatically convert to UUID, however being slightly slower. Different methods could be chosen, due to a change by Hypixel they have substantially limited the previous way of getting data through username directly.

// Slightly slower
client.getPlayer('caykie')
    .then(console.log);

// Fastest way
client.getPlayer('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
    .then(console.log);

Legacy Player Data:

This is strongly not recommended as you will most likely need to cache data if you are fetching based on the username of the player. We strongly recommend using the data fetch above.

client.legacyGetPlayer('caykie')
    .then(console.log);

client.legacyGetPlayer('eea2d4fd-a8b8-413b-9439-f06faaf7e109', 'uuid')
    .then(console.log);

Fetch Player Friends:

This method technically only supports UUIDs, and we do recommend using them. You can still supply a player username, however it will take slightly longer to fetch data from the Mojang API.

// Better to use
client.getFriends('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
    .then(console.log);

// Slightly slower
client.getFriends("caykie")
    .then(console.log);

Fetch Player Recent Games:

The player that you are requesting to get must have their recent games settings in the /settings menu on Hypixel enabled, otherwise you will not be able to see their recent games.

Again you can specify a username if you want, however we strongly recommend using a UUID if you can as it reduces wait time from additional requests.

// Better to use
client.getRecentGames('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
    .then(console.log);

// Slightly slower
client.getRecentGames('caykie')
    .then(console.log);

Fetch Player Status:

If the player specified is online and they have the setting to show player status enabled in /settings on Hypixel, this information will show, it is on by default for all players except for staff.

Again you can specify a username if you want, however we strongly recommend using a UUID if you can as it reduces wait time from additional requests.

// Better to use
client.getStatus('eea2d4fd-a8b8-413b-9439-f06faaf7e109')
    .then(console.log);

// Slightly slower
client.getStatus('caykie')
    .then(console.log);

Fetch Guild:

You MUST provide a method on the Guild, depending on if you do it by the ID, Guild Member or Name.

client.getGuild("CactiveNetwork", "name")
    .then(console.log);

Fetch SkyBlock Profile:

For this, you must specify a profile ID or player UUID to get multiple.

If you enter a username, it will still convert but slightly slower than normal.

client.getSkyBlockProfile("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")
    .then(console.log);

Fetch SkyBlock Auctions on Player:

Specify a Player, Profile or UUID then provide a method of 'uuid', 'player', or 'profile'.

You can provide a username, as said before it is slightly slower than normal.

client.getSkyBlockAuctions("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")
    .then(console.log);

Get Active SkyBlock Auctions:

Optionally specify a page, defaulting to 0 and see the active SkyBlock auctions.

client.getActiveSkyBlockAuctions(0)
    .then(console.log);

Resources:

Get Player Count:

You can get the Player Count of all of Hypixel or just certain gamemodes.

client.getPlayerCounts
    .then(console.log);

Get Leaderboards:

Get all of the different gamemode leaderboards.

client.getLeaderboards
    .then(console.log);

Get Punishment Statistics:

Get total and recent punishment statistics by staff & watchdog.

client.getPunishmentStatistics
    .then(console.log);

Get Active Network Boosters:

Get the currently active network boosters that apply to all players.

client.getActiveBoosters
    .then(console.log);

Get List of Achievements:

Get a list of all the achievements and related information.

client.resourceAchievements
    .then(console.log);

Get List of Challenges:

Get a list of all the challenges and related information.

client.resourceChallenges
    .then(console.log);

Get List of Quests:

Get a list of all the quests and related information.

client.resourceQuests
    .then(console.log);

Get List of Guild Achievements:

Get a list of all the guild achievements and related information.

client.resourceGuildAchievements
    .then(console.log);

Get List of Guild Permissions:

Get a list of all the guild permissions and related information.

client.resourceGuildPermissions
    .then(console.log);

Get List of SkyBlock Collections:

Get a list of all the SkyBlock collections and related information.

client.resourceSkyBlockCollections
    .then(console.log);

Get List of SkyBlock Skills:

Get a list of all the SkyBlock skills and related information.

client.resourceSkyBlockSkills
    .then(console.log);

Get SkyBlock News:

Get a list of the SkyBlock news pages on the forums for game updates and bug fixes.

client.getSkyBlockNews
    .then(console.log);

Get Ended SkyBlock Auctions:

Get a list of the ended SkyBlock auctions on the Hypixel Network.

client.getEndedSkyBlockAuctions
    .then(console.log);

Get SkyBlock Bazaar:

Get SkyBlock Bazaar information.

client.getSkyBlockBazaar
    .then(console.log);

Additional Resources:

Convert Username or UUID to either:

Sends a request to Mojang to get the Username and or UUID.

const log = console.log;

log(Hypixel.convertUser("eea2d4fd-a8b8-413b-9439-f06faaf7e109")); // caykie

// If you want to force something to be a UUID or Username do;

log(Hypixel.convertUser("eea2d4fd-a8b8-413b-9439-f06faaf7e109", "uuid")); // eea2d4fd-a8b8-413b-9439-f06faaf7e109

Added Dashes to UUID:

Does not send any requests and instantly adds dashes to a UUID if not done already.

const log = console.log;

log(Hypixel.fixUUID("eea2d4fda8b8413b9439f06faaf7e109")); // eea2d4fd-a8b8-413b-9439-f06faaf7e109

Get Method of Converting to Name or UUID:

This will respond with either uuid or name.

const log = console.log;

log(Hypixel.getMethod("eea2d4fda8b8413b9439f06faaf7e109")); // uuid
log(Hypixel.getMethod("eea2d4fd-a8b8-413b-9439-f06faaf7e109")); // uuid
log(Hypixel.getMethod("caykie")); // name

hypixel.js's People

Contributors

caykey avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.