npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pikanetwork.js

v1.1.5

Published

An easy to use PikaNetwork API wrapper.

Downloads

170

Readme

banner

An easy to use PikaNetwork API wrapper.

npm package Downloads Issues

About

pikanetwork.js is a NodeJS module which allows you to interact with the PikaNetwork API easily.

  • Written in JavaScript
  • Frequently updated
  • 100% coverage of PikaNetwork API

Installation

Node.js 14+ or newer is required

npm install pikanetwork.js
yarn add pikanetwork.js
pnpm add pikanetwork.js

Usage

Profile

const { Profile } = require("pikanetwork.js");

async function fetchProfile() {
  const playerIGN = "PikaNetwork";
  const profile = new Profile(playerIGN);

  try {
    const ranks = await profile.getRankInfo(); // Get information about the player's ranks.
    const levelling = await profile.getLevellingInfo(); // Get information about the player's network level and rank.
    const guild = await profile.getGuildInfo(); // Guild information about the player's guild.
    const friends = await profile.getFriendList(); // Get a list of friends the player has.
    const joinInfo = await profile.getJoinInfo(); // Get information about the player's estimated first join and last join.
    const miscInfo = await profile.getMiscInfo(); // Get other miscellaneous information.
  } catch (error) {
    console.error("Error fetching data:", error);
  }
}

fetchProfile();

Punishments

const { Punishments } = require("pikanetwork.js");

async function fetchPunishments() {
  const playerIGN = "MrFrenco";
  const punishment = new Punishments(playerIGN);

  try {
    const punishments = await punishment.getPunishments(); // Get a list of all of the player's punishments.
    const issued = await punishment.getIssuedPunishments(); // Get a list of punishments issued by this player.
  } catch (error) {
    console.error("Error fetching punishments:", error);
  }
}

fetchPunishments();

Player Leaderboard

const { PlayerLeaderboard } = require("pikanetwork.js");

async function fetchPlayerLeaderboard() {
  const playerIGN = "PikaNetwork";
  const interval = "total"; // total, monthly, weekly.
  const mode = "ALL_MODES"; // ALL_MODES, SOLO, DOUBLES, TRIPLES, QUAD.
  const gamemode = "bedwars";
  // bedwars, skywars, rankedpractice, unrankedpractice, kitpvp,
  // classicskyblock, survival, lifesteal, opskyblock, oplifesteal
  // opfactions, opprison. These are all options for gamemode.
  const playerLeaderboard = new PlayerLeaderboard(playerIGN, interval, mode, gamemode);

  try {
    const leaderboard = await playerLeaderboard.getLeaderboardData(); // Get the player's leaderboard based on set parameters.
    const kdr = await playerLeaderboard.getKDR(); // Get the player's kill/death ratio.
    const fkdr = await playerLeaderboard.getFKDR(); // Get the player's final kill/final death ratio.
    const wlr = await playerLeaderboard.getWLR(); // Get the player's win/loss ratio.
  } catch (error) {
    console.error("Error fetching data:", error);
  }
}

fetchPlayerLeaderboard();

Total Leaderboard

const { TotalLeaderboard } = require("pikanetwork.js");

async function fetchTotalLeaderboard() {
  const interval = "total"; // total, monthly, weekly.
  const mode = "ALL_MODES"; // ALL_MODES, SOLO, DOUBLES, TRIPLES, QUAD.
  const stat = "wins"; // Too many to be listed (varies from game to game).
  const gamemode = "bedwars";
  // bedwars, skywars, rankedpractice, unrankedpractice, kitpvp,
  // classicskyblock, survival, lifesteal, opskyblock, oplifesteal
  // opfactions, opprison. These are all options for gamemode.
  const offset = "0";
  const limit = "25";
  // The offset is at which postion the leaderboard starts (0 = #1 is the first).
  // The limit is upto how many players will be shown, the limit is capped at 25.
  const totalLeaderboard = new TotalLeaderboard(interval, mode, stat, offset, limit, gamemode);
  try {
    const leaderboard = await totalLeaderboard.fetchLeaderboardData(); // Get the total leaderboard based on set parameters.
  } catch (error) {
    console.error("Error fetching data:", error);
  }
}

fetchTotalLeaderboard();

Staff

const { Staff } = require("pikanetwork.js");

async function fetchStaffList() {
  try {
    const staff = new Staff();
    const list = await staff.getStaffList();
    console.log(list);
  } catch (error) {
    console.error("Error fetching data:", error);
  }
}

fetchStaffList();

Contributing

Contributions are welcome! If you have any suggestions or issues, please open an issue or pull request.

License

This project is licensed under the MIT License. See the LICENSE.

Help

If you're having issues with a method, or the wrapper isn't working as expected, you can DM tejaslamba or mrspeedy35 on Discord.

Acknowledgements

Please note that the data given out by our code belongs to PikaNetwork.