@confis/discordapiwrapper
Version:
A fast and lightweight discord api wrapper.
36 lines (34 loc) • 756 B
JavaScript
/**
* Base class for all API objects.
*/
class Base {
constructor(client) {
Object.defineProperty(this, "_client", {
value: client,
configurable: false,
enumerable: false,
});
}
/**
* Returns the client
*/
get client() {
return this._client;
}
_clone() {
return Object.assign(Object.create(this), this);
}
/**
* Returns a JSON representation of the object.
*/
toJson() {
const dict = {};
for (const [k, v] of Object.entries(this)) {
if (k !== "client")
Reflect.set(dict, k, v?.id ?? v?.toJSON?.() ?? v);
}
return dict;
}
_patch(data) { }
}
exports.Base = Base;