@niclqs/cfx-data-fetcher

1.0.2 • Public • Published

CFX-Data-Fetcher (12/2022 Working!)

This package can help you to interact with Cfx.re.



How to install

npm i @niclqs/cfx-data-fetcher

Basic template:

const cfx = require('@niclqs/cfx-data-fetcher');

(async () => {
    const server = await cfx.fetchServerData('xxxxxx');
    const status = await cfx.fetchCfxStatus();
})();


API Reference (Serverdata)

Returns: Endpoint (e. g. xxxxxx)

  server.getEndpoint()

Returns: Gametype (e. g. Roleplay)

  server.getGametype()

Returns: getHostname (e. g. ^7YOURROLEPLAYSERVER ^5TEST-BASED)

  server.getHostname()

Returns: getMapname (e. g. San Andreas)

  server.getMapname()

Returns: getMapname (e. g. San Andreas)

  server.getMapname()

Returns: getPlayerCount (e. g. 10)

  server.getPlayerCount()

Returns: getMaxSlots (e. g. 1000)

  server.getMaxSlots()

Returns: getResources (As array; e. g. ["testscript1", "testscript2"])

  server.getResources()

Returns: getServerVersion (e. g. FXServer-master SERVER v1.0.0.5848 win32)

  server.getServerVersion()

Returns: getVars (As array; e. g. Voice, Discord, OneSync)

  server.getVars()

Returns: getOnlinePlayers (As array; A player includes: endpoint, id, identifiers, name and ping)

  server.getOnlinePlayers()

Returns: getServerOwnerId (Return the ID from the owner)

  server.getServerOwnerId()

Returns: getServerOwnerName (Return the Name from the owner)

  server.getServerOwnerName()

Returns: isServerPrivate (Return true or false)

  server.isServerPrivate()

Returns: getUpvotes (Current Upvotes)

  server.getUpvotes()

Returns: getBurstUpvotes (Current BurstUpvotes)

  server.getBurstUpvotes()

Returns: getServerPatreonBadge (NONE, AURUM, ARGENTUM, PLATINUM)

  server.getServerPatreonBadge()

Returns: getJson (Return everything about the Server; As with the master list also)

  server.getJson()


API Reference (CFX Status)

Returns: isOnline (True/False)

  status.isOnline()

Returns: getPageJson (e. g. latest update, time_zone, ...)

  status.getPageJson()

Returns: getStatusJson (indicator, description; e. g. All Systems Operational)

  status.getStatusJson()

Package Sidebar

Install

npm i @niclqs/cfx-data-fetcher

Weekly Downloads

3

Version

1.0.2

License

ISC

Unpacked Size

8.7 kB

Total Files

11

Last publish

Collaborators

  • niclqs