-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Base.ts
31 lines (27 loc) · 796 Bytes
/
Base.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
import type { Client } from "./Client";
/**
* The base of all structures in this library.
* All structures that have an ID will extend this class.
*/
export class Base<T = { id: string }, R = string> {
/** Identifier of this structrure */
public id: R;
/** Bare data of this structure */
public raw: T;
constructor(
public readonly client: Client,
data: T & {
id: R;
},
) {
this.id = data.id;
this.raw = data;
}
/**
* Taken from https://github.com/discordjs/discord.js/blob/8e8d9b490a71de6cabe6f16375d7549a7c5c3737/src/structures/Base.js#L20
* Licensed under the Apache License 2.0 <https://github.com/discordjs/discord.js/blob/8e8d9b490a71de6cabe6f16375d7549a7c5c3737/LICENSE>
*/
public _clone(): this {
return Object.assign(Object.create(this), this);
}
}