aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushDMChannel.ts
blob: 87382ecb6155b0a106fd53cd9fc227ed1dceae1d (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
35
36
37
38
39
40
41
42
43
44
45
import type {
	BushCategoryChannel,
	BushClient,
	BushMessageManager,
	BushNewsChannel,
	BushStageChannel,
	BushTextBasedChannel,
	BushTextChannel,
	BushThreadChannel,
	BushUser,
	BushVoiceBasedChannel,
	BushVoiceChannel
} from '#lib';
import { DMChannel, PartialGroupDMChannel, type Partialize } from 'discord.js';
import type { RawDMChannelData } from 'discord.js/typings/rawDataTypes';

/**
 * Represents a direct message channel between two users.
 */
export class BushDMChannel extends DMChannel {
	public declare readonly client: BushClient;
	public declare messages: BushMessageManager;

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

export interface BushDMChannel extends DMChannel {
	get recipient(): BushUser | null;
	isText(): this is BushTextChannel;
	isDM(): this is BushDMChannel;
	isDMBased(): this is PartialGroupDMChannel | BushDMChannel;
	isVoice(): this is BushVoiceChannel;
	isCategory(): this is BushCategoryChannel;
	isNews(): this is BushNewsChannel;
	isThread(): this is BushThreadChannel;
	isStage(): this is BushStageChannel;
	isTextBased(): this is BushTextBasedChannel;
	isVoiceBased(): this is BushVoiceBasedChannel;
}

export interface PartialBushDMChannel extends Partialize<BushDMChannel, null, null, 'lastMessageId'> {
	lastMessageId: undefined;
}