mee6-levels-api

An unofficial wrapper around the Mee6 levels API to fetch the leaderboard, role rewards and user xp data.


Keywords
nodejs, mee6, discord, js, javascript, api
License
MIT
Install
npm install mee6-levels-api@1.3.1

Documentation

mee6-levels-api

An unofficial API wrapper for the Mee6 levels plugin.

Note

While this package works (at the time of writing this), it is neither developed nor officially supported by the Mee6 team. The API route used here is undocumented and is subject to change at any point of time.

Please do not ask for support for this package at the Mee6 Support server. Instead, you may message me directly at rjt#2336 or open an issue here for any concerns related to this package.

Installation

Install from npm as follows:

npm install mee6-levels-api

Usage

const Mee6LevelsApi = require("mee6-levels-api");

const guildId = "159962941502783488"; // or a Guild object with the id property
const userId = "258258856189231104"; // or a User object with the id property

Mee6LevelsApi.getLeaderboardPage(guildId).then(leaderboard => {
	// do something with leaderboard
	console.log(`${leaderboard.length} members ranked on the leaderboard.`);
});

Mee6LevelsApi.getRoleRewards(guildId).then(rewards => {
	// do something with rewards
	for (const reward of rewards)
		console.log(`${reward.role.name} - Given at level ${reward.level}`);
});

Mee6LevelsApi.getUserXp(guildId, userId).then(user => {
	// do something with user info
	console.log(`${user.tag} is at level ${user.level} and rank ${user.rank}.`);
});

Configuration

Open the leaderboard settings in the MEE6 dashboard and enable the option: Make my server's leaderboard public. It is not possible to fetch data from the dashboard if this option is not enabled and the error 'Response code 401' will be returned.