drep.js
v1.2.6
Published
Unofficial wrapper for the DiscordRep API returning the actually relevant info in a neatly organized manner.
Downloads
16
Readme
drep.js
Unofficial rewrite of DiscordRep.js, wrapper of the DiscordRep API.
Install
$ npm i drep.js
Why
As of writing this, the official drep wrapper uses cloudscraper. Given the chance of receiving a cloudflare issue is close to zero, this implementation uses centra-aero, a much much more lightweight lib. Also I've made all endpoints easily extendable, and added classes to the responses for consistent results, instead of just using JSON.parse() on the api output.
On a side note; there is no speed difference between this and discordrep.js. I've ran several benchmarks with consistent results:
drep.js x 3.42 ops/sec ±6.60% (21 runs sampled)
discordrep.js x 3.30 ops/sec ±8.27% (21 runs sampled)
Fastest is drep.js, discordrep.js
Usage
const { DRepClient } = require('drep.js');
const drep = new DRepClient('your-fancy-token');
Endpoints
class DRepClient {
rep(user: string): Reputation;
ban(user: string): Ban;
warn(user: string): Warn;
user(user: string): User;
}
Return Types
interface Reputation {
upvotes: number;
downvotes: number;
reputation: number;
xp: number;
}
interface Ban {
banned: boolean;
moderator?: string;
reason?: string;
}
interface Warn {
warned: boolean;
moderator?: string;
reason?: string;
}
interface User {
id: string;
bio: string;
donator: number;
partner: boolean;
admin: boolean;
mod: boolean;
}