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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
import type {
BushClient,
BushGuild,
BushGuildCacheMessage,
BushGuildMember,
BushGuildTextBasedChannel,
BushTextBasedChannel,
BushUser
} from '#lib';
import type { APIInteractionGuildMember, APIModalSubmitInteraction } from 'discord-api-types/v10';
import {
InteractionDeferUpdateOptions,
InteractionResponse,
InteractionUpdateOptions,
MessagePayload,
ModalSubmitInteraction,
type CacheType,
type CacheTypeReducer
} from 'discord.js';
/**
* Represents a button interaction.
*/
export class BushModalSubmitInteraction<Cached extends CacheType = CacheType> extends ModalSubmitInteraction<Cached> {
public declare member: CacheTypeReducer<Cached, BushGuildMember, APIInteractionGuildMember>;
public declare user: BushUser;
public constructor(client: BushClient, data: APIModalSubmitInteraction) {
super(client, data);
}
}
export interface BushModalSubmitInteraction<Cached extends CacheType = CacheType> extends ModalSubmitInteraction<Cached> {
get channel(): CacheTypeReducer<
Cached,
BushGuildTextBasedChannel | null,
BushGuildTextBasedChannel | null,
BushGuildTextBasedChannel | null,
BushTextBasedChannel | null
>;
get guild(): CacheTypeReducer<Cached, BushGuild, null>;
inGuild(): this is BushModalSubmitInteraction<'raw' | 'cached'>;
inCachedGuild(): this is BushModalSubmitInteraction<'cached'>;
inRawGuild(): this is BushModalSubmitInteraction<'raw'>;
isFromMessage(): this is BushModalMessageModalSubmitInteraction<Cached>;
}
export interface BushModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
extends ModalSubmitInteraction<Cached> {
/**
* The message associated with this interaction
*/
message: BushGuildCacheMessage<Cached>;
/**
* Updates the original message of the component on which the interaction was received on.
* @param options The options for the updated message
* @example
* // Remove the components from the message
* interaction.update({
* content: "A component interaction was received",
* components: []
* })
* .then(console.log)
* .catch(console.error);
*/
update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<BushGuildCacheMessage<Cached>>;
update(options: string | MessagePayload | InteractionUpdateOptions): Promise<InteractionResponse>;
/**
* Defers an update to the message to which the component was attached.
* @param options Options for deferring the update to this interaction
* @example
* // Defer updating and reset the component's loading state
* interaction.deferUpdate()
* .then(console.log)
* .catch(console.error);
*/
deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<BushGuildCacheMessage<Cached>>;
deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse>;
/**
* Indicates whether this interaction is received from a guild.
*/
inGuild(): this is BushModalMessageModalSubmitInteraction<'raw' | 'cached'>;
/**
* Indicates whether or not this interaction is both cached and received from a guild.
*/
inCachedGuild(): this is BushModalMessageModalSubmitInteraction<'cached'>;
/**
* Indicates whether or not this interaction is received from an uncached guild.
*/
inRawGuild(): this is BushModalMessageModalSubmitInteraction<'raw'>;
}
|