{"id":27291017,"url":"https://github.com/intercaetera/discovery","last_synced_at":"2025-07-19T05:02:44.695Z","repository":{"id":57212865,"uuid":"108647381","full_name":"intercaetera/discovery","owner":"intercaetera","description":"NPM module for querying the DiscoveryGC API.","archived":false,"fork":false,"pushed_at":"2017-10-28T14:02:57.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T05:06:59.441Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intercaetera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-28T12:30:42.000Z","updated_at":"2018-02-10T20:36:41.000Z","dependencies_parsed_at":"2022-09-12T11:12:27.968Z","dependency_job_id":null,"html_url":"https://github.com/intercaetera/discovery","commit_stats":null,"previous_names":["mrhuds0n/discovery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/intercaetera/discovery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercaetera%2Fdiscovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercaetera%2Fdiscovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercaetera%2Fdiscovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercaetera%2Fdiscovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intercaetera","download_url":"https://codeload.github.com/intercaetera/discovery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intercaetera%2Fdiscovery/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265883685,"owners_count":23843795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-11T21:55:49.528Z","updated_at":"2025-07-19T05:02:44.673Z","avatar_url":"https://github.com/intercaetera.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# discovery\nNPM module for querying the DiscoveryGC API.\n\n## Installation\n\n```\nnpm install --save discoverygc\n// OR\nyarn add discoverygc\n```\n\n## Import\n\n```js\n// ES5\nvar Disco = require('discoverygc').default\n\nvar options = {\n\tkey: \"your api key here\"\n}\n\nvar disco = new Disco(options)\n```\n\n```js\n// ESNext\nimport Disco from 'discoverygc'\n\nconst options = {\n\tkey: \"your api key here\"\n}\n\nconst disco = new Disco(options)\n```\n\n## Usage\n\n### Options\n\nWhen creating the instance of `disco` you can specify options in the constructor.\n\n- `key`: Your api key. This is mandatory.\n- `api`: Should the api URL ever change, you can specify a different one.\n- `noFormat`: This will make every function return unformatted Discovery API object keys. These do not adhere to StandardJS style guidelines for naming functions.\n\n### Functions\n\nFor unformatted outputs go look up the Discovery API docs.\n\nAll functions take callback and timeout (in ms) as their last two arguments.\n\nIf callback is undefined returns a Promise which resolves to the data, otherwise calls the callback with data as the first argument.\n\nAll data related to time (aside from the timestamps) is provided as Strings, you need to parse it yourself.\n\n#### `players([callback[, timeout]])`\n\nReturns the current online player list.\n\n```js\n{\n\tplayers: {\n\t\tname: String,\n\t\tsystem: String,\n\t\tregion: String,\n\t\tping: Number.\n\t\ttime: String\n\t},\n\ttimestamp: Date\n}\n```\n\n#### `factions([callback[, timeout]])`\n\nReturns faction activity data.\n\n`currentTime` and `lastTime` is activity for this month and previous month respectively.\n\n```js\n{\n\tfactions: {\n\t\ttag: String,\n\t\tname: String,\n\t\tunofficial: Boolean,\n\t\topenTag: Boolean,\n\t\tcurrentTime: String,\n\t\tlastTime: String,\n\t\tdanger: Boolean,\n\t\tid: Number\n\t}\n\ttimestamp: Date\n}\n```\n\n#### `allPlayers(page[, callback[, timeout]])`\n\nReturns individual player statistics separated into pages sorted by activity.\n\n`page` is required.\n\n```js\n{\n\tplayers: {\n\t\tname: String,\n\t\tcurrentTime: String,\n\t\tlastTime: String\n\t},\n\tlastPage: Number,\n\ttimestamp: Date\n}\n```\n\n## Examples\n\nLog all online players into the console.\n\n```js\n//ES5 and callbacks\nvar Disco = require('discoverygc').default\nvar disco = new Disco({key: \"potato\"})\n\ndisco.players(data =\u003e {\n\tconsole.log(data)\n})\n```\n\n```js\n//ES6, CommonJS and promises\nconst Disco = require('discoverygc').default\nconst disco = new Disco({key: \"potato\"})\n\ndisco.players().then(data =\u003e console.log(data))\n```\n\n```js\n//ESNext, imports and async-await\nimport Disco from 'discoverygc'\nconst disco = new Disco({key: \"potato\"})\n\n;(async function() {\n\tconsole.log(await disco.players())\n})()\n```\n\nLog all unofficial faction names.\n\n```js\nimport Disco from 'discoverygc'\nconst disco = new Disco({key: \"potato\"})\n\n;(async function() {\n\n\t// We're not using a callback, but we want a timeout of 5 seconds.\n\t// We need await because the request is asynchronous.\n\tlet data = await disco.factions(null, 5000)\t\n\n\t// First we will filter out all factions we aren't interested in.\n\tlet factions = data.factions.filter(faction =\u003e {\n\t\t// We check if the faction is unofficial and if it isn't an open tag.\n\t\tif(faction.unofficial \u0026\u0026 !faction.openTag) return true\n\t\n\t// Next we flatten the objects to just strings of their names.\n\t}).map(faction =\u003e {\n\t\treturn faction.name\n\t})\n\n\t// Finally we log the faction names.\n\tconsole.log(factions)\n\t\n})()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercaetera%2Fdiscovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintercaetera%2Fdiscovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintercaetera%2Fdiscovery/lists"}