seyfert/src/structures/ClientUser.ts
David 017ccfc3bf
fix: github actions (#210)
* fix: github actions

* fix: pnpm version

* fix: github actions checkout

* fix: brackets in failure function

* fix: github actions

* fix: github actions

* fix: github actions

* fix: github actions

* fix: github actions

* fix: github actions

* fix: github actions

* fix: github actions

* chore: apply formatting

* fix: github actions

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-14 14:23:58 -04:00

25 lines
747 B
TypeScript

import type { GatewayReadyDispatchData, RESTPatchAPICurrentUserJSONBody } from 'discord-api-types/v10';
import type { UsingClient } from '../commands';
import { User } from './User';
export class ClientUser extends User {
bot = true;
constructor(
client: UsingClient,
data: GatewayReadyDispatchData['user'],
public application: GatewayReadyDispatchData['application'],
) {
super(client, data);
}
async fetch() {
const data = await this.api.users('@me').get();
return new ClientUser(this.client, data, this.application);
}
async edit(body: RESTPatchAPICurrentUserJSONBody) {
const data = await this.api.users('@me').patch({ body });
return new ClientUser(this.client, data, this.application);
}
}