Skip to content

ElijahPepe/multiversus.js

Repository files navigation

multiversus.js

Discord server npm version

About

A simple Node.js module to access the MultiVersus API.

Installation

npm install multiversus.js
yarn add multiversus.js

Example usage

Initialize the client using your Steam username and password (if your account doesn't have Steam Guard):

const { Client } = require('multiversus.js');
const client = new Client();

(async () => {
	await client.login('username', 'password'); // You can initialize the client by supplying your Steam username and password
})();

Alternatively, initialize the client as follows, using a pre-existing access token. Access tokens can be obtained by analyzing the network requests made by MultiVersus using a tool such as Fiddler (if using Fiddler, make sure HTTPS traffic is decrypted):

const { Client } = require('multiversus.js');
const client = new Client({ accessToken: 'accessToken' });

Get the MultiVersus 2v2 leaderboard:

(async () => {
	const leaderboardData = await client.leaderboards.fetch('2v2'); // The type of the leaderboard to be retrieved can also be set to '1v1'.
	console.log(leaderboardData);
})();

Get a profile by a user's ID:

(async () => {
	const userData = await client.profiles.fetch('62e471bc5f77e966a384a570');
	console.log(userData);
})();

Search for users:

(async () => {
	const searchData = await client.profiles.search('ElijahPepe'); // A second parameter can also be defined to limit the results returned.
	console.log(searchData);
})();

Links