Coder Social home page Coder Social logo

mcstatus-io / node-mcstatus Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 4.0 262 KB

The Node.js library for interacting with the mcstatus.io API.

Home Page: https://npmjs.com/package/node-mcstatus

License: MIT License

TypeScript 16.90% JavaScript 83.10%
minecraft minecraft-status node-library

node-mcstatus's Introduction

node-mcstatus

The official Node.js library for interacting with the mcstatus.io API.

Getting Started

Firstly, you will need to install the library. Open your terminal/command line in your workspace where your package.json file is located, and run the following command.

npm install node-mcstatus

Usage

Java Status

const mcs = require('node-mcstatus');

// ...

const host = 'demo.mcstatus.io';
const port = 25565;
const options = { query: true };

// The `port` argument is optional and defaults
// to 25565. The `options` argument is optional.
mcs.statusJava(host, port, options)
    .then((result) => {
        // `result` will be the same shape and
        // properties as what is documented on
        // our website.
        // https://mcstatus.io/docs#java-status
    })
    .catch((error) => {
        // If the server is offline, then
        // you will NOT receive an error here.
        // Instead, you will use the `result.online`
        // boolean values in `.then()`.
        // Receiving an error here means that there
        // was an error with the service itself.
    })

Bedrock Status

const mcs = require('node-mcstatus');

// ...

const host = 'demo.mcstatus.io';
const port = 19132;

// The `port` argument is optional and defaults
// to 19132.
mcs.statusBedrock(host, port)
    .then((result) => {
        // ...
        // `result` will be the same shape and
        // properties as what is documented on
        // our website.
        // https://mcstatus.io/docs#bedrock-status
    })
    .catch((error) => {
        // If the server is offline, then
        // you will NOT receive an error here.
        // Instead, you will use the `result.online`
        // boolean values in `.then()`.
        // Receiving an error here means that there
        // was an error with the service itself.
    })

License

MIT License

node-mcstatus's People

Contributors

hvlxh avatar khrj avatar passthemayo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-mcstatus's Issues

BaseURL option doesn't actually work...

Hey there!

I saw the recent update that added the baseURL option and I think this is a wonderful addition! However, when I tried to use it, it does not do anything. I found that this is due to hardcoded values from the node-mcstatus/dist/enum.d.ts file being read into the dist/status.d.ts file (which is what is then imported). Unsure if this is just the new source code (from node-mcstatus/src) not being built yet or if there are additional steps that need to be taken here?

Player list (bedrock)

Feature: As well as in the java status, you can get the list of players in the bedrock status ๐Ÿ‘

Option to not fetch query

Feature request: I'm using this for a Discord bot to detect changes in my server's uptime and I don't want to fetch query. Any way to pass in an options object where query is disabled?

Would have implemented it myself but the formatting rules seem pretty strict and I don't want to screw them up.

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.