aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts
blob: 35e6301937f85c1e6939366998e64d5e17f2b5e9 (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
import type { BushClient, BushGuild, BushGuildMember, BushGuildTextBasedChannel, BushTextBasedChannel, BushUser } from '#lib';
import type { APIInteractionGuildMember } from 'discord-api-types/v9';
import { SelectMenuInteraction, type CacheType, type CacheTypeReducer } from 'discord.js';
import type { RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes';

/**
 * Represents a select menu interaction.
 */
export class BushSelectMenuInteraction<Cached extends CacheType = CacheType> extends SelectMenuInteraction<Cached> {
	public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>;
	public declare user: BushUser;

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

export interface BushSelectMenuInteraction<Cached extends CacheType = CacheType> extends SelectMenuInteraction<Cached> {
	get channel(): CacheTypeReducer<
		Cached,
		BushGuildTextBasedChannel | null,
		BushGuildTextBasedChannel | null,
		BushGuildTextBasedChannel | null,
		BushTextBasedChannel | null
	>;
	get guild(): CacheTypeReducer<Cached, BushGuild, null>;
	inGuild(): this is BushSelectMenuInteraction<'raw' | 'cached'>;
	inCachedGuild(): this is BushSelectMenuInteraction<'cached'>;
	inRawGuild(): this is BushSelectMenuInteraction<'raw'>;
}