aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushMessage.ts
blob: b442196ca07d05862cc4eb6c83007f890f6feb94 (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
import type {
	BushClient,
	BushCommandUtil,
	BushGuild,
	BushGuildMember,
	BushGuildTextBasedChannel,
	BushTextBasedChannel,
	BushUser
} from '#lib';
import { Message, type If, type Partialize } from 'discord.js';
import type { RawMessageData } from 'discord.js/typings/rawDataTypes';

export type PartialBushMessage = Partialize<
	BushMessage,
	'type' | 'system' | 'pinned' | 'tts',
	'content' | 'cleanContent' | 'author'
>;

/**
 * Represents a message on Discord.
 */
export class BushMessage<Cached extends boolean = boolean> extends Message<Cached> {
	public declare readonly client: BushClient;
	public declare util: BushCommandUtil<BushMessage<true>>;
	public declare readonly guild: If<Cached, BushGuild>;
	public declare readonly member: BushGuildMember | null;
	public declare author: BushUser;
	public declare readonly channel: If<Cached, BushGuildTextBasedChannel, BushTextBasedChannel>;

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

export interface BushMessage<Cached extends boolean = boolean> extends Message<Cached> {
	fetch(force?: boolean): Promise<BushMessage>;
}