-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.d.ts
45 lines (41 loc) · 1.8 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Type definitions for discord-xp v1.1.8
// Project: https://github.com/MrAugu/discord-xp
// Definitions by: Nico Finkernagel <https://github.com/gruselhaus/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Client } from "discord.js";
type User = {
userID: string;
guildID: string;
xp: number;
level: number;
lastUpdated: Date;
cleanXp: number;
cleanNextLevelXp: number;
};
type LeaderboardUser = {
guildID: string;
userID: string;
xp: number;
level: number;
position: number;
username: String | null;
discriminator: String | null;
};
declare module "discord-xp" {
export default class DiscordXp {
static async setURL(dbURL: string): Promise<void>;
static async createUser(userId: string, guildId: string): Promise<User>;
static async deleteUser(userId: string, guildId: string): Promise<User>;
static async deleteGuild(guildId: string): Promise<Guild>;
static async appendXp(userId: string, guildId: string, xp: number): Promise<boolean>;
static async appendLevel(userId: string, guildId: string, levels: number): Promise<User>;
static async setXp(userId: string, guildId: string, xp: number): Promise<User>;
static async setLevel(userId: string, guildId: string, level: number): Promise<User>;
static async fetch(userId: string, guildId: string, fetchPosition = false): Promise<User>;
static async subtractXp(userId: string, guildId: string, xp: number): Promise<User>;
static async subtractLevel(userId: string, guildId: string, level: number): Promise<User>;
static async fetchLeaderboard(guildId: String, limit: number): Promise<User[] | []>;
static async computeLeaderboard(client: Client, leaderboard: User[], fetchUsers = false): Promise<LeaderboardUser[] | []>;
static xpFor(targetLevel: number): number;
}
}