@fluxerjs/core 1.0.8 → 1.0.9

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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Collection } from '@fluxerjs/collection';
2
1
  import * as _fluxerjs_types from '@fluxerjs/types';
3
- import { APIWebhook, APIChannel, APIChannelPartial, ChannelType, APIRole, APIGuild, APIMessageAttachment, APIMessage, APIEmbed, APIUserPartial, APIGuildMember, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData } from '@fluxerjs/types';
2
+ import { APIWebhook, APIWebhookUpdateRequest, APIWebhookTokenUpdateRequest, APIChannel, APIChannelPartial, ChannelType, APIMessageAttachment, MessageType, APIEmbed, APIMessageSticker, APIMessageReaction, APIMessageReference, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIGuildMember, APIRole, APIGuild, APIGuildAuditLog, APIGuildPartial, APIInvite, APIBan, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, APIEmoji, APISticker } from '@fluxerjs/types';
4
3
  export { GatewayOpcodes, Routes } from '@fluxerjs/types';
4
+ import { Collection } from '@fluxerjs/collection';
5
5
  import { EmbedBuilder } from '@fluxerjs/builders';
6
6
  export { AttachmentBuilder, EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
7
7
  import { EventEmitter } from 'events';
@@ -51,7 +51,7 @@ declare class Webhook extends Base {
51
51
  readonly client: Client;
52
52
  readonly id: string;
53
53
  readonly guildId: string;
54
- readonly channelId: string;
54
+ channelId: string;
55
55
  name: string;
56
56
  avatar: string | null;
57
57
  /** Present only when webhook was created via createWebhook(); not returned when fetching. */
@@ -62,6 +62,12 @@ declare class Webhook extends Base {
62
62
  });
63
63
  /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
64
64
  delete(): Promise<void>;
65
+ /**
66
+ * Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
67
+ * @param options - Fields to update (name, avatar, channel_id when using bot auth)
68
+ * @returns This webhook instance with updated fields
69
+ */
70
+ edit(options: APIWebhookUpdateRequest | APIWebhookTokenUpdateRequest): Promise<Webhook>;
65
71
  /**
66
72
  * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
67
73
  * @throws Error if token is not available
@@ -152,6 +158,11 @@ declare class TextChannel extends GuildChannel {
152
158
  }): Promise<Message>;
153
159
  /** Message manager for this channel. Use channel.messages.fetch(messageId). */
154
160
  get messages(): MessageManager;
161
+ /**
162
+ * Fetch pinned messages in this channel.
163
+ * @returns Pinned messages
164
+ */
165
+ fetchPinnedMessages(): Promise<Message[]>;
155
166
  /**
156
167
  * Fetch a message by ID from this channel.
157
168
  * @param messageId - Snowflake of the message
@@ -186,6 +197,11 @@ declare class DMChannel extends Channel {
186
197
  }): Promise<Message>;
187
198
  /** Message manager for this channel. Use channel.messages.fetch(messageId). */
188
199
  get messages(): MessageManager;
200
+ /**
201
+ * Fetch pinned messages in this DM channel.
202
+ * @returns Pinned messages
203
+ */
204
+ fetchPinnedMessages(): Promise<Message[]>;
189
205
  /**
190
206
  * Fetch a message by ID from this DM channel.
191
207
  * @param messageId - Snowflake of the message
@@ -195,80 +211,6 @@ declare class DMChannel extends Channel {
195
211
  fetchMessage(messageId: string): Promise<Message | null>;
196
212
  }
197
213
 
198
- /** Represents a role in a guild. */
199
- declare class Role extends Base {
200
- readonly client: Client;
201
- readonly id: string;
202
- readonly guildId: string;
203
- name: string;
204
- color: number;
205
- position: number;
206
- permissions: string;
207
- hoist: boolean;
208
- mentionable: boolean;
209
- unicodeEmoji: string | null;
210
- /** @param client - The client instance */
211
- /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
212
- /** @param guildId - The guild this role belongs to */
213
- constructor(client: Client, data: APIRole, guildId: string);
214
- /** Returns a mention string (e.g. `<@&123456>`). */
215
- toString(): string;
216
- }
217
-
218
- /** Represents a Fluxer guild (server). */
219
- declare class Guild extends Base {
220
- readonly client: Client;
221
- readonly id: string;
222
- name: string;
223
- icon: string | null;
224
- banner: string | null;
225
- readonly ownerId: string;
226
- members: Collection<string, GuildMember>;
227
- channels: Collection<string, GuildChannel>;
228
- roles: Collection<string, Role>;
229
- /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
230
- constructor(client: Client, data: APIGuild & {
231
- roles?: APIRole[];
232
- });
233
- /** Get the guild icon URL, or null if no icon. */
234
- iconURL(options?: {
235
- size?: number;
236
- }): string | null;
237
- /** Get the guild banner URL, or null if no banner. */
238
- bannerURL(options?: {
239
- size?: number;
240
- }): string | null;
241
- /**
242
- * Add a role to a member by user ID. Does not require fetching the member first.
243
- * @param userId - The user ID of the member
244
- * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
245
- * Requires Manage Roles permission.
246
- */
247
- addRoleToMember(userId: string, roleId: string): Promise<void>;
248
- /**
249
- * Remove a role from a member by user ID. Does not require fetching the member first.
250
- * @param userId - The user ID of the member
251
- * @param roleId - The role ID to remove
252
- * Requires Manage Roles permission.
253
- */
254
- removeRoleFromMember(userId: string, roleId: string): Promise<void>;
255
- /**
256
- * Resolve a role ID from an argument (role mention, raw ID, or name).
257
- * Fetches guild roles if name is provided.
258
- * @param arg - Role mention (@role), role ID, or role name
259
- * @returns The role ID, or null if not found
260
- */
261
- resolveRoleId(arg: string): Promise<string | null>;
262
- /**
263
- * Fetch a guild member by user ID.
264
- * @param userId - The user ID of the member to fetch
265
- * @returns The guild member, or null if not found
266
- */
267
- fetchMember(userId: string): Promise<GuildMember | null>;
268
- /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
269
- fetchWebhooks(): Promise<Webhook[]>;
270
- }
271
-
272
214
  /** Options for editing a message (content and/or embeds). */
273
215
  interface MessageEditOptions {
274
216
  /** New text content */
@@ -288,6 +230,17 @@ declare class Message extends Base {
288
230
  readonly editedAt: Date | null;
289
231
  pinned: boolean;
290
232
  readonly attachments: Collection<string, APIMessageAttachment>;
233
+ readonly type: MessageType;
234
+ readonly flags: number;
235
+ readonly mentionEveryone: boolean;
236
+ readonly tts: boolean;
237
+ readonly embeds: APIEmbed[];
238
+ readonly stickers: APIMessageSticker[];
239
+ readonly reactions: APIMessageReaction[];
240
+ readonly messageReference: APIMessageReference | null;
241
+ readonly messageSnapshots: APIMessageSnapshot[];
242
+ readonly call: APIMessageCall | null;
243
+ readonly referencedMessage: Message | null;
291
244
  /** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
292
245
  get channel(): Channel | null;
293
246
  /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
@@ -341,6 +294,10 @@ declare class Message extends Base {
341
294
  fetch(): Promise<Message | null>;
342
295
  /** Delete this message. */
343
296
  delete(): Promise<void>;
297
+ /** Pin this message to the channel. Requires Manage Messages permission. */
298
+ pin(): Promise<void>;
299
+ /** Unpin this message from the channel. Requires Manage Messages permission. */
300
+ unpin(): Promise<void>;
344
301
  /**
345
302
  * Format emoji for reaction API: unicode string or "name:id" for custom.
346
303
  * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
@@ -434,6 +391,12 @@ declare class GuildMember extends Base {
434
391
  readonly roles: string[];
435
392
  readonly joinedAt: Date;
436
393
  communicationDisabledUntil: Date | null;
394
+ readonly mute: boolean;
395
+ readonly deaf: boolean;
396
+ readonly avatar: string | null;
397
+ readonly banner: string | null;
398
+ readonly accentColor: number | null;
399
+ readonly profileFlags: number | null;
437
400
  /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
438
401
  constructor(client: Client, data: APIGuildMember & {
439
402
  guild_id?: string;
@@ -454,6 +417,140 @@ declare class GuildMember extends Base {
454
417
  removeRole(roleId: string): Promise<void>;
455
418
  }
456
419
 
420
+ /** Represents a role in a guild. */
421
+ declare class Role extends Base {
422
+ readonly client: Client;
423
+ readonly id: string;
424
+ readonly guildId: string;
425
+ name: string;
426
+ color: number;
427
+ position: number;
428
+ permissions: string;
429
+ hoist: boolean;
430
+ mentionable: boolean;
431
+ unicodeEmoji: string | null;
432
+ /** @param client - The client instance */
433
+ /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
434
+ /** @param guildId - The guild this role belongs to */
435
+ constructor(client: Client, data: APIRole, guildId: string);
436
+ /** Returns a mention string (e.g. `<@&123456>`). */
437
+ toString(): string;
438
+ }
439
+
440
+ /** Represents a Fluxer guild (server). */
441
+ declare class Guild extends Base {
442
+ readonly client: Client;
443
+ readonly id: string;
444
+ name: string;
445
+ icon: string | null;
446
+ banner: string | null;
447
+ readonly ownerId: string;
448
+ members: Collection<string, GuildMember>;
449
+ channels: Collection<string, GuildChannel>;
450
+ roles: Collection<string, Role>;
451
+ /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
452
+ constructor(client: Client, data: APIGuild & {
453
+ roles?: APIRole[];
454
+ });
455
+ /** Get the guild icon URL, or null if no icon. */
456
+ iconURL(options?: {
457
+ size?: number;
458
+ }): string | null;
459
+ /** Get the guild banner URL, or null if no banner. */
460
+ bannerURL(options?: {
461
+ size?: number;
462
+ }): string | null;
463
+ /**
464
+ * Add a role to a member by user ID. Does not require fetching the member first.
465
+ * @param userId - The user ID of the member
466
+ * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
467
+ * Requires Manage Roles permission.
468
+ */
469
+ addRoleToMember(userId: string, roleId: string): Promise<void>;
470
+ /**
471
+ * Remove a role from a member by user ID. Does not require fetching the member first.
472
+ * @param userId - The user ID of the member
473
+ * @param roleId - The role ID to remove
474
+ * Requires Manage Roles permission.
475
+ */
476
+ removeRoleFromMember(userId: string, roleId: string): Promise<void>;
477
+ /**
478
+ * Resolve a role ID from an argument (role mention, raw ID, or name).
479
+ * Fetches guild roles if name is provided.
480
+ * @param arg - Role mention (@role), role ID, or role name
481
+ * @returns The role ID, or null if not found
482
+ */
483
+ resolveRoleId(arg: string): Promise<string | null>;
484
+ /**
485
+ * Fetch a guild member by user ID.
486
+ * @param userId - The user ID of the member to fetch
487
+ * @returns The guild member, or null if not found
488
+ */
489
+ fetchMember(userId: string): Promise<GuildMember | null>;
490
+ /**
491
+ * Fetch guild audit logs. Requires View Audit Log permission.
492
+ * @param options - Optional limit, before, after, user_id, action_type for filtering
493
+ */
494
+ fetchAuditLogs(options?: {
495
+ limit?: number;
496
+ before?: string;
497
+ after?: string;
498
+ userId?: string;
499
+ actionType?: number;
500
+ }): Promise<APIGuildAuditLog>;
501
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
502
+ fetchWebhooks(): Promise<Webhook[]>;
503
+ }
504
+
505
+ /** Represents an invite to a guild or channel. */
506
+ declare class Invite extends Base {
507
+ readonly client: Client;
508
+ readonly code: string;
509
+ readonly type: number;
510
+ readonly guild: APIGuildPartial;
511
+ readonly channel: APIChannelPartial;
512
+ readonly inviter: User | null;
513
+ readonly memberCount: number | null;
514
+ readonly presenceCount: number | null;
515
+ readonly expiresAt: string | null;
516
+ readonly temporary: boolean | null;
517
+ readonly createdAt: string | null;
518
+ readonly uses: number | null;
519
+ readonly maxUses: number | null;
520
+ readonly maxAge: number | null;
521
+ /** @param data - API invite from GET /invites/{code}, channel/guild invite list, or gateway INVITE_CREATE */
522
+ constructor(client: Client, data: APIInvite);
523
+ /** Full invite URL (https://fluxer.gg/{code} or instance-specific). */
524
+ get url(): string;
525
+ /**
526
+ * Resolve the guild from cache if available.
527
+ * @returns The guild, or null if not cached
528
+ */
529
+ getGuild(): Guild | null;
530
+ /**
531
+ * Delete this invite.
532
+ * Requires Manage Guild or Create Instant Invite permission.
533
+ */
534
+ delete(): Promise<void>;
535
+ }
536
+
537
+ /** Represents a ban in a guild. */
538
+ declare class GuildBan extends Base {
539
+ readonly client: Client;
540
+ readonly guildId: string;
541
+ readonly user: User;
542
+ readonly reason: string | null;
543
+ /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
544
+ constructor(client: Client, data: APIBan & {
545
+ guild_id?: string;
546
+ }, guildId: string);
547
+ /**
548
+ * Remove this ban (unban the user).
549
+ * Requires Ban Members permission.
550
+ */
551
+ unban(): Promise<void>;
552
+ }
553
+
457
554
  /** Represents a reaction added to or removed from a message. */
458
555
  declare class MessageReaction extends Base {
459
556
  readonly client: Client;
@@ -656,8 +753,8 @@ interface ClientEvents {
656
753
  [Events.MessageDeleteBulk]: [
657
754
  data: _fluxerjs_types.GatewayMessageDeleteBulkDispatchData
658
755
  ];
659
- [Events.GuildBanAdd]: [data: _fluxerjs_types.GatewayGuildBanAddDispatchData];
660
- [Events.GuildBanRemove]: [data: _fluxerjs_types.GatewayGuildBanRemoveDispatchData];
756
+ [Events.GuildBanAdd]: [ban: GuildBan];
757
+ [Events.GuildBanRemove]: [ban: GuildBan];
661
758
  [Events.GuildEmojisUpdate]: [data: unknown];
662
759
  [Events.GuildStickersUpdate]: [data: unknown];
663
760
  [Events.GuildIntegrationsUpdate]: [data: unknown];
@@ -668,8 +765,10 @@ interface ClientEvents {
668
765
  [Events.GuildScheduledEventUpdate]: [data: unknown];
669
766
  [Events.GuildScheduledEventDelete]: [data: unknown];
670
767
  [Events.ChannelPinsUpdate]: [data: unknown];
671
- [Events.InviteCreate]: [data: unknown];
672
- [Events.InviteDelete]: [data: unknown];
768
+ [Events.InviteCreate]: [invite: Invite];
769
+ [Events.InviteDelete]: [
770
+ data: _fluxerjs_types.GatewayInviteDeleteDispatchData
771
+ ];
673
772
  [Events.TypingStart]: [data: _fluxerjs_types.GatewayTypingStartDispatchData];
674
773
  [Events.UserUpdate]: [data: _fluxerjs_types.GatewayUserUpdateDispatchData];
675
774
  [Events.PresenceUpdate]: [data: unknown];
@@ -750,6 +849,59 @@ declare class Client extends EventEmitter {
750
849
  static get Routes(): typeof Routes;
751
850
  }
752
851
 
852
+ /** Represents a custom emoji in a guild. */
853
+ declare class GuildEmoji extends Base {
854
+ readonly client: Client;
855
+ readonly id: string;
856
+ readonly guildId: string;
857
+ name: string;
858
+ readonly animated: boolean;
859
+ /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
860
+ constructor(client: Client, data: APIEmoji & {
861
+ guild_id?: string;
862
+ }, guildId: string);
863
+ /** CDN URL for this emoji image. */
864
+ get url(): string;
865
+ /** Emoji identifier for use in reactions: `name:id` */
866
+ get identifier(): string;
867
+ /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
868
+ delete(): Promise<void>;
869
+ /**
870
+ * Edit this emoji's name.
871
+ * Requires Manage Emojis and Stickers permission.
872
+ */
873
+ edit(options: {
874
+ name: string;
875
+ }): Promise<GuildEmoji>;
876
+ }
877
+
878
+ /** Represents a custom sticker in a guild. */
879
+ declare class GuildSticker extends Base {
880
+ readonly client: Client;
881
+ readonly id: string;
882
+ readonly guildId: string;
883
+ name: string;
884
+ description: string;
885
+ readonly tags: string[];
886
+ readonly animated: boolean;
887
+ /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
888
+ constructor(client: Client, data: APISticker & {
889
+ guild_id?: string;
890
+ }, guildId: string);
891
+ /** CDN URL for this sticker image. */
892
+ get url(): string;
893
+ /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
894
+ delete(): Promise<void>;
895
+ /**
896
+ * Edit this sticker's name and/or description.
897
+ * Requires Manage Emojis and Stickers permission.
898
+ */
899
+ edit(options: {
900
+ name?: string;
901
+ description?: string;
902
+ }): Promise<GuildSticker>;
903
+ }
904
+
753
905
  declare class FluxerError extends Error {
754
906
  constructor(message: string);
755
907
  }
@@ -759,4 +911,4 @@ declare const ErrorCodes: {
759
911
  readonly InvalidToken: "INVALID_TOKEN";
760
912
  };
761
913
 
762
- export { Base, CategoryChannel, Channel, ChannelManager, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildChannel, GuildMember, LinkChannel, Message, type MessageEditOptions, MessageManager, MessageReaction, type PartialMessage, Role, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };
914
+ export { Base, CategoryChannel, Channel, ChannelManager, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildBan, GuildChannel, GuildEmoji, GuildMember, GuildSticker, Invite, LinkChannel, Message, type MessageEditOptions, MessageManager, MessageReaction, type PartialMessage, Role, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };