seyfert
Version:
The most advanced framework for discord bots
50 lines (49 loc) • 1.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientUser = void 0;
const User_1 = require("./User");
/**
* Represents a client user that extends the base User class.
* This class is used to interact with the authenticated user.
*
* @extends User
*/
class ClientUser extends User_1.User {
application;
/**
* Indicates if the user is a bot.
* @type {true}
*/
bot = true;
/**
* Creates an instance of ClientUser.
*
* @param client - The client instance used for making API requests.
* @param data - The user data received from the gateway.
* @param application - The application data received from the gateway.
*/
constructor(client, data, application) {
super(client, data);
this.application = application;
}
/**
* Fetches the current user data from the API.
*
* @returns A promise that resolves to the ClientUserStructure.
*/
async fetch() {
const data = await this.api.users('@me').get();
return this.__patchThis(data);
}
/**
* Edits the current user data.
*
* @param body - The data to update the user with.
* @returns A promise that resolves to the updated ClientUserStructure.
*/
async edit(body) {
const data = await this.api.users('@me').patch({ body });
return this.__patchThis(data);
}
}
exports.ClientUser = ClientUser;