@fluxerjs/core 2.2.0 → 3.1.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.
@@ -0,0 +1,461 @@
1
+ import { OverwriteType, ChannelType, APIMessage, APIChannel, APIMessageSearchResponse } from '@fluxerjs/types';
2
+ import { PermissionResolvable } from '@fluxerjs/util';
3
+
4
+ /** Attachment upload / message attachment SDK options. */
5
+ /** Edits to an existing message attachment (by `id`) when editing a message. */
6
+ interface MessageAttachmentEdit {
7
+ id: number | string;
8
+ filename?: string;
9
+ uploadFilename?: string;
10
+ fileSize?: number;
11
+ contentType?: string;
12
+ title?: string | null;
13
+ description?: string | null;
14
+ flags?: number;
15
+ }
16
+ /** Convert {@link MessageAttachmentEdit} entries to wire attachment objects. */
17
+ declare function toMessageAttachmentEditWire(attachments: readonly MessageAttachmentEdit[]): Array<Record<string, unknown>>;
18
+ /** Plan item for {@link Channel.requestAttachmentUploads}. */
19
+ interface AttachmentUploadPlanItem {
20
+ id: number;
21
+ filename: string;
22
+ fileSize: number;
23
+ contentType: string;
24
+ }
25
+ /** Convert plan items to the attachments request wire body. */
26
+ declare function toAttachmentUploadPlanBody(attachments: readonly AttachmentUploadPlanItem[]): {
27
+ attachments: Array<Record<string, unknown>>;
28
+ };
29
+ /** Multipart complete item for {@link Channel.completeAttachmentUploads}. */
30
+ interface AttachmentUploadCompleteItem {
31
+ uploadFilename: string;
32
+ uploadId: string;
33
+ }
34
+ /** Convert complete items to the attachments/complete wire body. */
35
+ declare function toAttachmentUploadCompleteBody(uploads: readonly AttachmentUploadCompleteItem[]): {
36
+ uploads: Array<{
37
+ upload_filename: string;
38
+ upload_id: string;
39
+ }>;
40
+ };
41
+ /** Part in a multipart upload plan response. */
42
+ interface AttachmentUploadPartPayload {
43
+ partNumber: number;
44
+ uploadUrl: string;
45
+ }
46
+ /** Singlepart plan response item. */
47
+ interface AttachmentUploadSinglepartPayload {
48
+ id: number;
49
+ filename: string;
50
+ uploadFilename: string;
51
+ fileSize: number;
52
+ contentType: string;
53
+ uploadMode: 'singlepart';
54
+ uploadUrl: string;
55
+ }
56
+ /** Multipart plan response item. */
57
+ interface AttachmentUploadMultipartPayload {
58
+ id: number;
59
+ filename: string;
60
+ uploadFilename: string;
61
+ fileSize: number;
62
+ contentType: string;
63
+ uploadMode: 'multipart';
64
+ uploadId: string;
65
+ partSize: number;
66
+ parts: AttachmentUploadPartPayload[];
67
+ }
68
+ type AttachmentUploadPlanResponseItem = AttachmentUploadSinglepartPayload | AttachmentUploadMultipartPayload;
69
+ /** CamelCase response from {@link Channel.requestAttachmentUploads}. */
70
+ interface AttachmentUploadPlanResponse {
71
+ attachments: AttachmentUploadPlanResponseItem[];
72
+ }
73
+ /** CamelCase response from {@link Channel.completeAttachmentUploads}. */
74
+ interface AttachmentUploadCompleteResponse {
75
+ uploads: Array<{
76
+ uploadFilename: string;
77
+ }>;
78
+ }
79
+ /** Map wire attachment plan response → camelCase. */
80
+ declare function toAttachmentUploadPlanResponse(data: {
81
+ attachments: Array<{
82
+ id: number;
83
+ filename: string;
84
+ upload_filename: string;
85
+ file_size: number;
86
+ content_type: string;
87
+ upload_mode: 'singlepart' | 'multipart';
88
+ upload_url?: string;
89
+ upload_id?: string;
90
+ part_size?: number;
91
+ parts?: Array<{
92
+ part_number: number;
93
+ upload_url: string;
94
+ }>;
95
+ }>;
96
+ }): AttachmentUploadPlanResponse;
97
+
98
+ /** Channel edit / invite / RTC / slowmode SDK options. */
99
+
100
+ /** A single permission overwrite for channel create/edit (`allow`/`deny` as {@link PermissionResolvable}). */
101
+ interface ChannelPermissionOverwriteOptions {
102
+ id: string;
103
+ type: OverwriteType;
104
+ allow?: PermissionResolvable;
105
+ deny?: PermissionResolvable;
106
+ }
107
+ /** Options for {@link GuildChannel.edit}. */
108
+ interface ChannelEditOptions {
109
+ name?: string | null;
110
+ topic?: string | null;
111
+ url?: string | null;
112
+ parentId?: string | null;
113
+ bitrate?: number | null;
114
+ userLimit?: number | null;
115
+ voiceConnectionLimit?: number | null;
116
+ nsfw?: boolean;
117
+ nsfwOverride?: boolean | null;
118
+ contentWarningLevel?: number | null;
119
+ contentWarningText?: string | null;
120
+ rateLimitPerUser?: number;
121
+ rtcRegion?: string | null;
122
+ permissionOverwrites?: ChannelPermissionOverwriteOptions[];
123
+ /** Group DM icon hash (base64 image). */
124
+ icon?: string | null;
125
+ /** Audit log reason (`X-Audit-Log-Reason`). Not sent in the JSON body. */
126
+ reason?: string;
127
+ }
128
+ /** Options for {@link Guild.createChannel}. */
129
+ interface GuildChannelCreateOptions {
130
+ name: string;
131
+ type: ChannelType;
132
+ topic?: string | null;
133
+ url?: string | null;
134
+ parentId?: string | null;
135
+ bitrate?: number | null;
136
+ userLimit?: number | null;
137
+ voiceConnectionLimit?: number | null;
138
+ permissionOverwrites?: ChannelPermissionOverwriteOptions[];
139
+ nsfw?: boolean;
140
+ nsfwOverride?: boolean | null;
141
+ contentWarningLevel?: number | null;
142
+ contentWarningText?: string | null;
143
+ rateLimitPerUser?: number | null;
144
+ }
145
+ /** Convert {@link ChannelEditOptions} to the channel PATCH wire body. */
146
+ declare function toChannelEditBody(options: ChannelEditOptions): Record<string, unknown>;
147
+ /** Convert {@link GuildChannelCreateOptions} to the channel POST wire body. */
148
+ declare function toChannelCreateBody(options: GuildChannelCreateOptions): Record<string, unknown>;
149
+ /** Options for {@link GuildChannel.createInvite}. */
150
+ interface ChannelInviteCreateOptions {
151
+ maxUses?: number;
152
+ maxAge?: number;
153
+ unique?: boolean;
154
+ temporary?: boolean;
155
+ }
156
+ /** Convert {@link ChannelInviteCreateOptions} to the invite create wire body. */
157
+ declare function toChannelInviteBody(options: ChannelInviteCreateOptions): Record<string, unknown>;
158
+ /** Options for {@link DMChannel.edit} (group DM name/icon/nicks). */
159
+ interface GroupDmEditOptions {
160
+ name?: string | null;
161
+ icon?: string | null;
162
+ nicks?: Record<string, string> | null;
163
+ }
164
+ /** Convert {@link GroupDmEditOptions} to GroupDmChannelUpdateRequest. */
165
+ declare function toGroupDmEditBody(options: GroupDmEditOptions): Record<string, unknown>;
166
+ interface RtcRegionPayload {
167
+ id: string;
168
+ name: string;
169
+ emoji: string;
170
+ }
171
+ /** CamelCase slowmode state from {@link Channel.fetchSlowmode}. */
172
+ interface ChannelSlowmodePayload {
173
+ rateLimitPerUser: number;
174
+ retryAfterMs: number;
175
+ nextSendAllowedAt: string | null;
176
+ }
177
+
178
+ /** Guild discovery SDK options and payloads. */
179
+ /** Options for applying a guild to discovery. */
180
+ interface DiscoveryApplicationOptions {
181
+ description?: string;
182
+ /** Discovery category (`category_type` on the wire). */
183
+ primaryCategoryId?: number | string;
184
+ /** Custom search tags (`custom_tags` on the wire). */
185
+ keywords?: string[];
186
+ /** Primary language code (`primary_language` on the wire). */
187
+ primaryLanguage?: string;
188
+ }
189
+ /** Convert {@link DiscoveryApplicationOptions} to the discovery wire body. */
190
+ declare function toDiscoveryBody(options: DiscoveryApplicationOptions): Record<string, unknown>;
191
+ /** CamelCase view of a guild's discovery application record. */
192
+ interface DiscoveryApplicationPayload {
193
+ guildId: string;
194
+ guildNsfwLevel?: number | null;
195
+ status: string;
196
+ description: string;
197
+ categoryType: number;
198
+ primaryLanguage?: string | null;
199
+ customTags?: string[];
200
+ appliedAt?: string;
201
+ reviewedAt?: string | null;
202
+ }
203
+ /** CamelCase discovery status. */
204
+ interface DiscoveryStatusPayload {
205
+ application?: DiscoveryApplicationPayload | null;
206
+ eligible: boolean;
207
+ minMemberCount: number;
208
+ }
209
+ /** Map wire discovery application → camelCase. */
210
+ declare function toDiscoveryApplicationPayload(data: {
211
+ guild_id: string;
212
+ guild_nsfw_level?: number | null;
213
+ status: string;
214
+ description: string;
215
+ category_type: number;
216
+ primary_language?: string | null;
217
+ custom_tags?: string[];
218
+ applied_at?: string;
219
+ reviewed_at?: string | null;
220
+ }): DiscoveryApplicationPayload;
221
+ /** Map wire discovery status → camelCase. */
222
+ declare function toDiscoveryStatusPayload(data: {
223
+ application?: {
224
+ guild_id: string;
225
+ guild_nsfw_level?: number | null;
226
+ status: string;
227
+ description: string;
228
+ category_type: number;
229
+ primary_language?: string | null;
230
+ custom_tags?: string[];
231
+ applied_at?: string;
232
+ reviewed_at?: string | null;
233
+ } | null;
234
+ eligible: boolean;
235
+ min_member_count: number;
236
+ }): DiscoveryStatusPayload;
237
+
238
+ /**
239
+ * CamelCase options for creating a guild role.
240
+ * Fluxer create accepts `name`, `color`, and `permissions` only.
241
+ */
242
+ interface RoleCreateOptions {
243
+ /** Role name. */
244
+ name?: string;
245
+ /** Permissions bitfield string or {@link PermissionResolvable}. */
246
+ permissions?: string | PermissionResolvable;
247
+ /** Role color as 24-bit RGB. */
248
+ color?: number;
249
+ /** Audit log reason (`X-Audit-Log-Reason`). Not sent in the JSON body. */
250
+ reason?: string;
251
+ }
252
+ /**
253
+ * CamelCase options for editing a guild role.
254
+ * Fluxer update accepts `name`, `color`, `permissions`, `hoist`, `hoist_position`, `mentionable`.
255
+ * `unicodeEmoji` is read-only on {@link Role}. Position changes use {@link Guild.setRolePositions}.
256
+ */
257
+ interface RoleEditOptions {
258
+ /** Role name. */
259
+ name?: string;
260
+ /** Permissions bitfield string or {@link PermissionResolvable}. */
261
+ permissions?: string | PermissionResolvable;
262
+ /** Role color as 24-bit RGB. */
263
+ color?: number;
264
+ /** Whether the role is displayed separately in the member list. */
265
+ hoist?: boolean;
266
+ /** Whether the role can be @mentioned. */
267
+ mentionable?: boolean;
268
+ /** Hoisted position (visual separator group). */
269
+ hoistPosition?: number | null;
270
+ /** Audit log reason (`X-Audit-Log-Reason`). Not sent in the JSON body. */
271
+ reason?: string;
272
+ }
273
+
274
+ /** Guild member search / edit SDK options. */
275
+ /** Filters and paging for {@link Guild.searchMembers}. */
276
+ interface GuildMemberSearchOptions {
277
+ query?: string;
278
+ limit?: number;
279
+ offset?: number;
280
+ roleIds?: string[];
281
+ joinedAtGte?: number;
282
+ joinedAtLte?: number;
283
+ isBot?: boolean;
284
+ userCreatedAtGte?: number;
285
+ userCreatedAtLte?: number;
286
+ sortBy?: 'joinedAt' | 'relevance';
287
+ sortOrder?: 'asc' | 'desc';
288
+ joinSourceType?: number[];
289
+ sourceInviteCode?: string[];
290
+ }
291
+ /** Convert {@link GuildMemberSearchOptions} to the wire search body. */
292
+ declare function toMemberSearchBody(options: GuildMemberSearchOptions): Record<string, unknown>;
293
+ /** Fields to update on a guild member (nick, roles, profile, voice/timeout state). */
294
+ interface GuildMemberEditOptions {
295
+ nick?: string | null;
296
+ roles?: string[];
297
+ avatar?: string | null;
298
+ banner?: string | null;
299
+ bio?: string | null;
300
+ pronouns?: string | null;
301
+ accentColor?: number | null;
302
+ profileFlags?: number | null;
303
+ mentionFlags?: number | null;
304
+ mute?: boolean;
305
+ deaf?: boolean;
306
+ communicationDisabledUntil?: string | null;
307
+ timeoutReason?: string | null;
308
+ channelId?: string | null;
309
+ connectionId?: string | null;
310
+ /** Audit log reason (`X-Audit-Log-Reason`). Not sent in the JSON body. */
311
+ reason?: string;
312
+ }
313
+ /** Convert {@link GuildMemberEditOptions} to the member PATCH wire body. */
314
+ declare function toMemberEditBody(options: GuildMemberEditOptions): Record<string, unknown>;
315
+
316
+ /** Message bulk-fetch SDK options. */
317
+
318
+ /** A single channel's request within a bulk message fetch. */
319
+ interface BulkFetchMessagesRequest {
320
+ channelId: string;
321
+ limit: number;
322
+ before?: string;
323
+ after?: string;
324
+ around?: string;
325
+ }
326
+ /** Convert bulk-fetch requests to wire items. */
327
+ declare function toBulkFetchWire(requests: readonly BulkFetchMessagesRequest[]): Array<{
328
+ channel_id: string;
329
+ limit: number;
330
+ before?: string;
331
+ after?: string;
332
+ around?: string;
333
+ }>;
334
+ /**
335
+ * CamelCase options for {@link Client.searchMessages}.
336
+ * The helper always sends `scope: 'current'` (the only bot-legal scope).
337
+ */
338
+ interface MessageSearchOptions {
339
+ content?: string;
340
+ contents?: string[];
341
+ exactPhrases?: string[];
342
+ channelIds?: string[];
343
+ excludeChannelIds?: string[];
344
+ contextGuildId?: string;
345
+ contextChannelId?: string;
346
+ hitsPerPage?: number;
347
+ page?: number;
348
+ cursor?: string[];
349
+ minId?: string;
350
+ maxId?: string;
351
+ authorIds?: string[];
352
+ excludeAuthorIds?: string[];
353
+ authorType?: Array<'user' | 'bot' | 'webhook'>;
354
+ excludeAuthorType?: Array<'user' | 'bot' | 'webhook'>;
355
+ mentions?: string[];
356
+ excludeMentions?: string[];
357
+ mentionEveryone?: boolean;
358
+ pinned?: boolean;
359
+ includeNsfw?: boolean;
360
+ has?: string[];
361
+ excludeHas?: string[];
362
+ sortBy?: string;
363
+ sortOrder?: 'asc' | 'desc';
364
+ }
365
+ /** Convert {@link MessageSearchOptions} to GlobalSearchMessagesRequest with `scope: current`. */
366
+ declare function toMessageSearchBody(options?: MessageSearchOptions): Record<string, unknown>;
367
+ /** Search is still indexing one or more channels. */
368
+ interface MessageSearchIndexing {
369
+ indexing: true;
370
+ }
371
+ /** Successful camelCase search page from {@link Client.searchMessages}. */
372
+ interface MessageSearchResults {
373
+ messages: APIMessage[];
374
+ channels: APIChannel[];
375
+ total: number;
376
+ hitsPerPage: number;
377
+ page: number;
378
+ cursor?: string[];
379
+ }
380
+ /** CamelCase response from {@link Client.searchMessages}. */
381
+ type MessageSearchResponse = MessageSearchResults | MessageSearchIndexing;
382
+ /** Map wire search response to camelCase. */
383
+ declare function toMessageSearchResponse(data: APIMessageSearchResponse): MessageSearchResponse;
384
+
385
+ /** Presence update SDK options. */
386
+ /** Options for `client.user.setPresence()` (status, activities, custom status). */
387
+ interface PresenceUpdateOptions {
388
+ status: 'online' | 'idle' | 'dnd' | 'invisible';
389
+ since?: number | null;
390
+ afk?: boolean;
391
+ activities?: Array<{
392
+ name: string;
393
+ type: number;
394
+ url?: string | null;
395
+ }>;
396
+ customStatus?: {
397
+ text?: string | null;
398
+ emojiName?: string | null;
399
+ emojiId?: string | null;
400
+ } | null;
401
+ }
402
+ /** Convert presence options to gateway opcode 3 payload. */
403
+ declare function toPresenceWire(options: PresenceUpdateOptions): Record<string, unknown>;
404
+
405
+ /** User profile SDK payloads. */
406
+ /** CamelCase user profile fields (pronouns, bio, banner, colors, theme). */
407
+ interface UserProfilePayload {
408
+ pronouns?: string | null;
409
+ bio?: string | null;
410
+ banner?: string | null;
411
+ accentColor?: number | null;
412
+ bannerColor?: number | null;
413
+ theme?: string | null;
414
+ }
415
+ /** CamelCase connected account. */
416
+ interface ConnectedAccountPayload {
417
+ name?: string | null;
418
+ type?: string | null;
419
+ }
420
+ /** CamelCase profile response from {@link UserManager.fetchWithProfile}. */
421
+ interface ProfilePayload {
422
+ userProfile?: UserProfilePayload | null;
423
+ mutualGuilds?: Array<{
424
+ id: string;
425
+ }> | null;
426
+ mutualGuildIds?: string[] | null;
427
+ connectedAccounts?: ConnectedAccountPayload[] | null;
428
+ }
429
+ /** Map wire profile → camelCase. */
430
+ declare function toProfilePayload(data: {
431
+ user_profile?: {
432
+ pronouns?: string | null;
433
+ bio?: string | null;
434
+ banner?: string | null;
435
+ accent_color?: number | null;
436
+ banner_color?: number | null;
437
+ theme?: string | null;
438
+ } | null;
439
+ mutual_guilds?: Array<{
440
+ id: string;
441
+ }> | null;
442
+ mutual_guild_ids?: string[] | null;
443
+ connected_accounts?: Array<{
444
+ name?: string | null;
445
+ type?: string | null;
446
+ }> | null;
447
+ }): ProfilePayload;
448
+
449
+ /** Sudo verification SDK options. */
450
+ /** Credentials for a sudo (elevated-action) verification: password and/or MFA. */
451
+ interface SudoVerificationOptions {
452
+ password?: string;
453
+ mfaMethod?: 'totp' | 'webauthn';
454
+ mfaCode?: string;
455
+ webauthnResponse?: Record<string, unknown>;
456
+ webauthnChallenge?: string;
457
+ }
458
+ /** Convert {@link SudoVerificationOptions} to the wire sudo body. */
459
+ declare function toSudoBody(options: SudoVerificationOptions): Record<string, unknown>;
460
+
461
+ export { type AttachmentUploadCompleteItem as A, type BulkFetchMessagesRequest as B, type ChannelEditOptions as C, type DiscoveryApplicationOptions as D, type DiscoveryStatusPayload as E, type GuildChannelCreateOptions as F, type GroupDmEditOptions as G, type GuildMemberEditOptions as H, type GuildMemberSearchOptions as I, type MessageSearchIndexing as J, type MessageSearchOptions as K, type MessageSearchResponse as L, type MessageAttachmentEdit as M, type MessageSearchResults as N, type ProfilePayload as O, type PresenceUpdateOptions as P, type RtcRegionPayload as Q, type RoleCreateOptions as R, type SudoVerificationOptions as S, type RoleEditOptions as a, toAttachmentUploadPlanBody as b, toAttachmentUploadPlanResponse as c, toBulkFetchWire as d, toChannelCreateBody as e, toChannelEditBody as f, toChannelInviteBody as g, toDiscoveryApplicationPayload as h, toDiscoveryBody as i, toDiscoveryStatusPayload as j, toGroupDmEditBody as k, toMemberEditBody as l, toMemberSearchBody as m, toMessageAttachmentEditWire as n, toMessageSearchBody as o, toMessageSearchResponse as p, toPresenceWire as q, toProfilePayload as r, toSudoBody as s, toAttachmentUploadCompleteBody as t, type AttachmentUploadCompleteResponse as u, type AttachmentUploadPlanItem as v, type AttachmentUploadPlanResponse as w, type ChannelInviteCreateOptions as x, type ChannelSlowmodePayload as y, type DiscoveryApplicationPayload as z };