seyfert 3.2.7-dev-18544835853.0 → 3.2.7-dev-18548516169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/builders/Attachment.d.ts +1 -0
- package/lib/builders/Attachment.js +3 -0
- package/lib/builders/index.d.ts +1 -0
- package/lib/builders/index.js +1 -0
- package/lib/structures/Interaction.d.ts +3 -0
- package/lib/structures/Interaction.js +14 -0
- package/lib/structures/channels.js +9 -4
- package/lib/types/payloads/_interactions/modalSubmit.d.ts +11 -1
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export interface Attachment extends ObjectToLower<APIAttachment> {
|
|
|
20
20
|
export declare class Attachment extends Base {
|
|
21
21
|
data: APIAttachment;
|
|
22
22
|
constructor(client: UsingClient, data: APIAttachment);
|
|
23
|
+
toJSON(): APIAttachment;
|
|
23
24
|
}
|
|
24
25
|
export declare class AttachmentBuilder {
|
|
25
26
|
data: Partial<AttachmentData>;
|
package/lib/builders/index.d.ts
CHANGED
package/lib/builders/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __exportStar(require("./Container"), exports);
|
|
|
37
37
|
__exportStar(require("./Embed"), exports);
|
|
38
38
|
__exportStar(require("./File"), exports);
|
|
39
39
|
__exportStar(require("./FileUpload"), exports);
|
|
40
|
+
__exportStar(require("./Label"), exports);
|
|
40
41
|
__exportStar(require("./MediaGallery"), exports);
|
|
41
42
|
__exportStar(require("./Modal"), exports);
|
|
42
43
|
__exportStar(require("./Poll"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RawFile } from '../api';
|
|
2
|
+
import { Attachment } from '../builders';
|
|
2
3
|
import type { ReturnCache } from '../cache';
|
|
3
4
|
import { type EntitlementStructure, type GuildRoleStructure, type GuildStructure, type InteractionGuildMemberStructure, type MessageStructure, type OptionResolverStructure, type UserStructure, type WebhookMessageStructure } from '../client/transformers';
|
|
4
5
|
import type { UsingClient } from '../commands';
|
|
@@ -208,6 +209,8 @@ export declare class ModalSubmitInteraction<FromGuild extends boolean = boolean>
|
|
|
208
209
|
}[];
|
|
209
210
|
getInputValue(customId: string, required: true): string | string[];
|
|
210
211
|
getInputValue(customId: string, required?: false): string | string[] | undefined;
|
|
212
|
+
getFiles(customId: string, required: true): Attachment[];
|
|
213
|
+
getFiles(customId: string, required?: false): Attachment[] | undefined;
|
|
211
214
|
isModal(): this is ModalSubmitInteraction;
|
|
212
215
|
}
|
|
213
216
|
export {};
|
|
@@ -524,6 +524,20 @@ let ModalSubmitInteraction = class ModalSubmitInteraction extends BaseInteractio
|
|
|
524
524
|
throw new Error(`${customId} component doesn't have a value`);
|
|
525
525
|
return value;
|
|
526
526
|
}
|
|
527
|
+
getFiles(customId, required) {
|
|
528
|
+
const value = this.getInputValue(customId, required);
|
|
529
|
+
if (value) {
|
|
530
|
+
const attachments = this.data.resolved?.attachments;
|
|
531
|
+
if (attachments) {
|
|
532
|
+
return Object.values(attachments).map(x => new builders_1.Attachment(this.client, {
|
|
533
|
+
...x,
|
|
534
|
+
proxy_url: x.url
|
|
535
|
+
}));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return undefined;
|
|
539
|
+
}
|
|
540
|
+
;
|
|
527
541
|
isModal() {
|
|
528
542
|
return true;
|
|
529
543
|
}
|
|
@@ -215,10 +215,15 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
|
215
215
|
};
|
|
216
216
|
if ('attachments' in body) {
|
|
217
217
|
payload.attachments =
|
|
218
|
-
body.attachments?.map((x, i) =>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
body.attachments?.map((x, i) => {
|
|
219
|
+
if (x instanceof builders_1.Attachment) {
|
|
220
|
+
return x.toJSON();
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
id: i.toString(),
|
|
224
|
+
...(0, builders_1.resolveAttachment)(x),
|
|
225
|
+
};
|
|
226
|
+
}) ?? undefined;
|
|
222
227
|
}
|
|
223
228
|
else if (files?.length) {
|
|
224
229
|
payload.attachments = files?.map(({ filename }, i) => ({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Snowflake } from '../..';
|
|
2
|
+
import type { APIActionRowComponent, APIAttachment, APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper, APIModalActionRowComponent, ComponentType, InteractionType } from '../index';
|
|
2
3
|
export interface ModalSubmitComponent {
|
|
3
4
|
type: ComponentType;
|
|
4
5
|
custom_id: string;
|
|
@@ -20,6 +21,15 @@ export interface APIModalSubmission {
|
|
|
20
21
|
* A list of child components
|
|
21
22
|
*/
|
|
22
23
|
components: ModalSubmitActionRowComponent[];
|
|
24
|
+
/**
|
|
25
|
+
* Resolved data structure
|
|
26
|
+
*/
|
|
27
|
+
resolved?: {
|
|
28
|
+
/**
|
|
29
|
+
* A map of attachments
|
|
30
|
+
*/
|
|
31
|
+
attachments: Record<Snowflake, Omit<APIAttachment, 'duration_secs' | 'waveform'>>;
|
|
32
|
+
};
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
35
|
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|