aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushUser.ts
blob: 27ef2b2bc7150ed65aeab0ef4f7094810411017a (plain)
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
import type { BushClient, BushDMChannel } from '#lib';
import { User, type Partialize } from 'discord.js';
import type { RawUserData } from 'discord.js/typings/rawDataTypes';

export type PartialBushUser = Partialize<BushUser, 'username' | 'tag' | 'discriminator' | 'isOwner' | 'isSuperUser'>;

/**
 * Represents a user on Discord.
 */
export class BushUser extends User {
	public declare readonly client: BushClient;

	public constructor(client: BushClient, data: RawUserData) {
		super(client, data);
	}

	/**
	 * Indicates whether the user is an owner of the bot.
	 */
	public isOwner(): boolean {
		return client.isOwner(this);
	}

	/**
	 * Indicates whether the user is a superuser of the bot.
	 */
	public isSuperUser(): boolean {
		return client.isSuperUser(this);
	}
}

export interface BushUser extends User {
	get dmChannel(): BushDMChannel | null;
}