0.0.27 • Published 3 months ago

frhd v0.0.27

Weekly downloads
24
License
GNU General Publi...
Repository
github
Last release
3 months ago

Wiki documentation

Installation

Node.js 18.0.0 or newer is required.

npm install frhd

Wiki

More information here.

Example usage

import frhd, { Client } from "frhd";

// const { Client } = frhd;

const client = new Client();

client.on("ready", function() {
	console.log("Ready!");
});

client.on("trackCommentMention", function(data) {
	console.log(data);
});

client.login("token");

// client.login({
//     username: "Guest",
//     password: "password"
// })

Builder API

import frhd, { Builder } from "frhd";

// const { Builder } = frhd;
const track = new Builder();

// Import tracks:
// track.code = "-18 1i 18 1i##"

track.beginPath();
track.moveTo(-40, 50);
track.lineTo(40, 50);
track.stroke();

console.log(track.code);

Expected Output:

"-18 1i 18 1i##"

Gamepad API

import frhd, { Gamepad } from "frhd";

// const { Gamepad } = frhd;
const gamepad = new Gamepad();

gamepad.on("tick", function(records) {
	// records = this.getReplayString();
	console.log(records);
});

gamepad.on("tick", function(ticks) {
	this.toggleKey(this.keymap[Math.floor(Math.random() * ticks) % 5]);
	/* switch(ticks) {
		case 0:
			this.setKeyDown("up");
			break;

		case 1:
			this.setKeyDown("left", "down");
			break;
	} */
	this.tick(10); // first param defines the maximum ticks
});

/* Or create a ghost manually
gamepad.setKeyDown("up");
gamepad.tick();
gamepad.setKeyUp("up");
gamepad.complete();
*/

Expected Output:

{
	up_down: [0, 2],
	up_up: [1, 8],
	left_down: [3, 5, 10],
	left_up: [4, 9],
	right_down: [6],
	right_up: [7]
}

Data Retrievers

This api requests data from Free Rider HD

Example 1 - Getting User Info:

import frhd, { getUser } from "frhd";

// getUser = frhd.getUser

getUser("Guest", /* Callback Option */ data => console.log(data)).then(data => console.log(data));

Expected Output:

interface User {
	admin: boolean | null,
	classic: boolean,
	cosmetics: CosmeticManager,
	createdTracks: TrackManager,
	displayName: string | null,
	id: number,
	mobileStats: {
		connected: boolean,
		headCount: number,
		level: number,
		wins: number
	} | null,
	moderator: boolean | null,
	plus: boolean,
	stats: {
		comments: number,
		completed: number,
		created: number,
		headCount: number,
		rated: number,
		totalHeadCount: number,
		totalPoints: number
	},
	username: string,
	friendCount: number,
	friends: FriendManager<User>,
	friendRequestCount: number,
	friendRequests: Array<FriendRequest>,
	friendLimitReached: boolean,
	likedTracks: TrackManager,
	recentlyCompleted: TrackManager,
	recentlyPlayed: TrackManager,
	subscriberCount: number | null,
	verifiedEmail: boolean
}

Example 2 - Getting Track Data:

import frhd, { getTrack } from "frhd";

// getTrack = frhd.getTrack

getTrack(1001, /* Callback Option */ data => console.log(data)).then(data => console.log(data));

Expected Output:

interface Track {
	allowedVehicles: Array<string>,
	author: User,
	comments: CommentManager<Comment>,
	createdAt: Date | null,
	createdTimestamp: number | null,
	daily: {
		entries: Array<object>,
		gems: number,
		lives: number,
		refillCost: number
	},
	defaultVehicle: string | null,
	description: string,
	featured: boolean,
	id: number,
	isCampaign: boolean,
	size: number,
	stats: {
		averageTime: string,
		completionRate: number,
		dislikes: number,
		firstRuns: number,
		likes: number,
		likesAverage: number,
		plays: string,
		runs: number,
		votes: number
	},
	title: string,
	thumbnail: string,
	vehicle: string
}
0.0.27

3 months ago

0.0.26

6 months ago

0.0.20

7 months ago

0.0.21

7 months ago

0.0.22

7 months ago

0.0.23

7 months ago

0.0.24

7 months ago

0.0.25

7 months ago

0.0.18

7 months ago

0.0.19

7 months ago

0.0.17

9 months ago

0.0.16

1 year ago

0.0.6-gold

2 years ago

0.0.10

2 years ago

0.0.6-dev.2oO8v

2 years ago

0.0.5

2 years ago

0.0.5-security

2 years ago

0.0.4-gamepad

2 years ago

0.0.4-dev

2 years ago

0.0.4-dev.4

2 years ago

0.0.4-dev.408

2 years ago

0.0.3-dev.6y2ege

2 years ago

0.0.3-dev.6y2eg

2 years ago

0.0.3-builder

2 years ago

0.0.3-dev.555d

2 years ago

2.0.1-security

3 years ago

0.0.1-security

3 years ago

0.0.2-security

3 years ago

2.0.1-dev.1e10f3

3 years ago

2.0.1-dev.1e10f0

3 years ago

2.0.1

3 years ago

2.0.1-beta

3 years ago

2.0.0

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.401

3 years ago

0.3.42

3 years ago

0.3.41

3 years ago

0.3.44

3 years ago

0.3.43

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.43

3 years ago

0.2.42

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.1

3 years ago

0.0.2

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.4

3 years ago

1.6.5

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.0

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago