@fluxerjs/core 1.1.1 → 1.1.3
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/{Channel-4WVFDOCG.mjs → Channel-YB3LWDHZ.mjs} +2 -2
- package/dist/{ClientUser-PXAAKR2P.mjs → ClientUser-URMZ5DEV.mjs} +1 -1
- package/dist/{Guild-FMBCTAV4.mjs → Guild-BL7JEF2B.mjs} +3 -3
- package/dist/{MessageReaction-AYSOCOMX.mjs → MessageReaction-GYQNJ6GX.mjs} +2 -2
- package/dist/{Role-5MWSGL66.mjs → Role-SERSJFJC.mjs} +1 -1
- package/dist/chunk-2ZSMLDEI.mjs +114 -0
- package/dist/{chunk-4F765HVV.mjs → chunk-5GTFNBZT.mjs} +2 -2
- package/dist/{chunk-V6T5VMWD.mjs → chunk-PU73YRKJ.mjs} +2 -1
- package/dist/{chunk-FRVZ7D6D.mjs → chunk-Q4LJQGF6.mjs} +121 -8
- package/dist/{chunk-K6NLD6SB.mjs → chunk-YL5S4W6R.mjs} +5 -5
- package/dist/{chunk-RWFKZ3DF.mjs → chunk-ZKKBIQBA.mjs} +1 -1
- package/dist/index.d.mts +134 -6
- package/dist/index.d.ts +134 -6
- package/dist/index.js +316 -59
- package/dist/index.mjs +127 -36
- package/package.json +7 -7
- package/dist/chunk-DQ4TNBPG.mjs +0 -63
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as _fluxerjs_types from '@fluxerjs/types';
|
|
2
|
-
import { APIEmbed, APIWebhook, APIWebhookUpdateRequest, APIWebhookTokenUpdateRequest, APIChannelOverwrite, APIChannel, APIChannelPartial, ChannelType, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, APIMessageAttachment, MessageType, APIMessageSticker, APIMessageReaction, APIMessageReference, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIGuildMember, APIRole, APIBan, GuildFeature, GuildVerificationLevel, DefaultMessageNotifications, GuildExplicitContentFilter, GuildMFALevel, APIGuild, APIGuildAuditLog, APIGuildPartial, APIInvite, GatewayPresenceUpdateData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildScheduledEventCreateDispatchData, GatewayGuildScheduledEventUpdateDispatchData, GatewayGuildScheduledEventDeleteDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayPresenceUpdateDispatchData, GatewayWebhooksUpdateDispatchData, GatewaySendPayload, Routes, APIEmoji, APISticker } from '@fluxerjs/types';
|
|
2
|
+
import { APIEmbed, APIWebhook, APIWebhookUpdateRequest, APIWebhookTokenUpdateRequest, APIChannelOverwrite, APIChannel, APIChannelPartial, ChannelType, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, APIMessageAttachment, MessageType, APIMessageSticker, APIMessageReaction, APIMessageReference, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIGuildMember, APIRole, RESTUpdateRoleBody, APIBan, GuildFeature, GuildVerificationLevel, DefaultMessageNotifications, GuildExplicitContentFilter, GuildMFALevel, APIGuild, RESTCreateRoleBody, APIGuildAuditLog, APIGuildPartial, APIInvite, GatewayPresenceUpdateData, APIProfileResponse, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildScheduledEventCreateDispatchData, GatewayGuildScheduledEventUpdateDispatchData, GatewayGuildScheduledEventDeleteDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayPresenceUpdateDispatchData, GatewayWebhooksUpdateDispatchData, GatewaySendPayload, Routes, APIEmoji, APISticker } from '@fluxerjs/types';
|
|
3
3
|
export { GatewayOpcodes, MessageAttachmentFlags, Routes } from '@fluxerjs/types';
|
|
4
|
+
import { PermissionResolvable } from '@fluxerjs/util';
|
|
5
|
+
export { PermissionFlags, PermissionResolvable, PermissionString, PermissionsBitField, UserFlagsBitField, UserFlagsBits, UserFlagsResolvable, UserFlagsString, resolvePermissionsToBitfield, resolveTenorToImageUrl } from '@fluxerjs/util';
|
|
4
6
|
import { Collection } from '@fluxerjs/collection';
|
|
5
7
|
import { EmbedBuilder } from '@fluxerjs/builders';
|
|
6
8
|
export { AttachmentBuilder, EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
|
|
7
9
|
import { EventEmitter } from 'events';
|
|
8
|
-
import { PermissionResolvable } from '@fluxerjs/util';
|
|
9
|
-
export { PermissionFlags, PermissionResolvable, PermissionString, PermissionsBitField, resolveTenorToImageUrl } from '@fluxerjs/util';
|
|
10
10
|
import { REST } from '@fluxerjs/rest';
|
|
11
11
|
import { WebSocketManager } from '@fluxerjs/ws';
|
|
12
12
|
|
|
@@ -715,6 +715,36 @@ declare class GuildMember extends Base {
|
|
|
715
715
|
private _computeBasePermissions;
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Manages guild members with a Collection-like API.
|
|
720
|
+
* Extends Collection so you can use .get(), .set(), .filter(), etc.
|
|
721
|
+
* Provides guild.members.me for Discord.js parity.
|
|
722
|
+
*/
|
|
723
|
+
declare class GuildMemberManager extends Collection<string, GuildMember> {
|
|
724
|
+
private readonly guild;
|
|
725
|
+
constructor(guild: Guild);
|
|
726
|
+
/**
|
|
727
|
+
* The current bot user as a GuildMember in this guild.
|
|
728
|
+
* Returns null if the bot's member is not cached or client.user is null.
|
|
729
|
+
* Use fetchMe() to load the bot's member when not cached.
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* const perms = guild.members.me?.permissions;
|
|
733
|
+
* if (perms?.has(PermissionFlags.BanMembers)) { ... }
|
|
734
|
+
*/
|
|
735
|
+
get me(): GuildMember | null;
|
|
736
|
+
/**
|
|
737
|
+
* Fetch the current bot user as a GuildMember in this guild.
|
|
738
|
+
* Caches the result in guild.members.
|
|
739
|
+
*
|
|
740
|
+
* @throws Error if client.user is null (client not ready)
|
|
741
|
+
* @example
|
|
742
|
+
* const me = await guild.members.fetchMe();
|
|
743
|
+
* console.log(me.displayName);
|
|
744
|
+
*/
|
|
745
|
+
fetchMe(): Promise<GuildMember>;
|
|
746
|
+
}
|
|
747
|
+
|
|
718
748
|
/** Represents a role in a guild. */
|
|
719
749
|
declare class Role extends Base {
|
|
720
750
|
readonly client: Client;
|
|
@@ -733,6 +763,8 @@ declare class Role extends Base {
|
|
|
733
763
|
/** @param data - API role from GET /guilds/{id}/roles or gateway role events */
|
|
734
764
|
/** @param guildId - The guild this role belongs to */
|
|
735
765
|
constructor(client: Client, data: APIRole, guildId: string);
|
|
766
|
+
/** Update mutable fields from fresh API data. Used by edit and gateway events. */
|
|
767
|
+
_patch(data: Partial<APIRole>): void;
|
|
736
768
|
/** Returns a mention string (e.g. `<@&123456>`). */
|
|
737
769
|
toString(): string;
|
|
738
770
|
/**
|
|
@@ -744,6 +776,22 @@ declare class Role extends Base {
|
|
|
744
776
|
* if (role.has('ManageChannels')) { ... }
|
|
745
777
|
*/
|
|
746
778
|
has(permission: PermissionResolvable): boolean;
|
|
779
|
+
/**
|
|
780
|
+
* Edit this role.
|
|
781
|
+
* Requires Manage Roles permission.
|
|
782
|
+
* @param options - Role updates (permissions accepts PermissionResolvable for convenience)
|
|
783
|
+
* @returns This role (updated in place)
|
|
784
|
+
* @example
|
|
785
|
+
* await role.edit({ name: 'Moderator', permissions: ['BanMembers', 'KickMembers'] });
|
|
786
|
+
*/
|
|
787
|
+
edit(options: RESTUpdateRoleBody & {
|
|
788
|
+
permissions?: string | PermissionResolvable;
|
|
789
|
+
}): Promise<Role>;
|
|
790
|
+
/**
|
|
791
|
+
* Delete this role.
|
|
792
|
+
* Requires Manage Roles permission.
|
|
793
|
+
*/
|
|
794
|
+
delete(): Promise<void>;
|
|
747
795
|
}
|
|
748
796
|
|
|
749
797
|
/** Represents a ban in a guild. */
|
|
@@ -800,7 +848,7 @@ declare class Guild extends Base {
|
|
|
800
848
|
splashWidth?: number | null;
|
|
801
849
|
/** Splash image height. Optional. */
|
|
802
850
|
splashHeight?: number | null;
|
|
803
|
-
members:
|
|
851
|
+
members: GuildMemberManager;
|
|
804
852
|
channels: Collection<string, GuildChannel>;
|
|
805
853
|
roles: Collection<string, Role>;
|
|
806
854
|
/** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
|
|
@@ -834,6 +882,29 @@ declare class Guild extends Base {
|
|
|
834
882
|
* Requires Manage Roles permission.
|
|
835
883
|
*/
|
|
836
884
|
removeRoleFromMember(userId: string, roleId: string): Promise<void>;
|
|
885
|
+
/**
|
|
886
|
+
* Create a role in this guild.
|
|
887
|
+
* Requires Manage Roles permission.
|
|
888
|
+
* @param options - Role data (permissions accepts PermissionResolvable for convenience)
|
|
889
|
+
* @returns The created role
|
|
890
|
+
* @example
|
|
891
|
+
* const role = await guild.createRole({ name: 'Mod', permissions: ['KickMembers', 'BanMembers'] });
|
|
892
|
+
*/
|
|
893
|
+
createRole(options: RESTCreateRoleBody & {
|
|
894
|
+
permissions?: string | PermissionResolvable;
|
|
895
|
+
}): Promise<Role>;
|
|
896
|
+
/**
|
|
897
|
+
* Fetch all roles in this guild.
|
|
898
|
+
* @returns Array of Role objects (cached in guild.roles)
|
|
899
|
+
*/
|
|
900
|
+
fetchRoles(): Promise<Role[]>;
|
|
901
|
+
/**
|
|
902
|
+
* Fetch a role by ID.
|
|
903
|
+
* @param roleId - The role ID to fetch
|
|
904
|
+
* @returns The role
|
|
905
|
+
* @throws FluxerError with ROLE_NOT_FOUND if role does not exist (404)
|
|
906
|
+
*/
|
|
907
|
+
fetchRole(roleId: string): Promise<Role>;
|
|
837
908
|
/**
|
|
838
909
|
* Resolve a role ID from an argument (role mention, raw ID, or name).
|
|
839
910
|
* Fetches guild roles if name is provided.
|
|
@@ -1106,6 +1177,62 @@ declare const Events: {
|
|
|
1106
1177
|
readonly Debug: "debug";
|
|
1107
1178
|
};
|
|
1108
1179
|
|
|
1180
|
+
/** Result of {@link UsersManager.fetchWithProfile}. */
|
|
1181
|
+
interface FetchedUserWithProfile {
|
|
1182
|
+
/** The user (cached in client.users). */
|
|
1183
|
+
user: User;
|
|
1184
|
+
/** Raw user data from GET /users/{id}. */
|
|
1185
|
+
userData: APIUserPartial;
|
|
1186
|
+
/** Global profile (bio, pronouns, mutual guilds, etc.). Null if unavailable. */
|
|
1187
|
+
globalProfile: APIProfileResponse | null;
|
|
1188
|
+
/** Server-specific profile when guildId was provided. Null if unavailable. */
|
|
1189
|
+
serverProfile: APIProfileResponse | null;
|
|
1190
|
+
/** Guild member when guildId was provided and user is in the guild. Null otherwise. */
|
|
1191
|
+
member: GuildMember | null;
|
|
1192
|
+
/** Raw member data when member exists (for premium_since, etc.). */
|
|
1193
|
+
memberData: (APIGuildMember & {
|
|
1194
|
+
user: {
|
|
1195
|
+
id: string;
|
|
1196
|
+
};
|
|
1197
|
+
}) | null;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Manages users with fetch and profile helpers.
|
|
1201
|
+
* Extends Collection so you can use .get(), .set(), .filter(), etc.
|
|
1202
|
+
*/
|
|
1203
|
+
declare class UsersManager extends Collection<string, User> {
|
|
1204
|
+
private readonly client;
|
|
1205
|
+
constructor(client: Client);
|
|
1206
|
+
/**
|
|
1207
|
+
* Fetch a user by ID from the API.
|
|
1208
|
+
* Updates cache if user already exists.
|
|
1209
|
+
* @param userId - Snowflake of the user
|
|
1210
|
+
* @returns The user
|
|
1211
|
+
* @throws FluxerError (or REST error) if user not found
|
|
1212
|
+
* @example
|
|
1213
|
+
* const user = await client.users.fetch(userId);
|
|
1214
|
+
* console.log(user.username);
|
|
1215
|
+
*/
|
|
1216
|
+
fetch(userId: string): Promise<User>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Fetch a user with full profile and optional guild context.
|
|
1219
|
+
* Returns user, global profile, server profile (when guildId), and member (when guildId).
|
|
1220
|
+
* Ideal for userinfo commands.
|
|
1221
|
+
* @param userId - Snowflake of the user
|
|
1222
|
+
* @param options - Optional guildId for server profile and member data
|
|
1223
|
+
* @returns User, raw data, profiles, and member (when in guild)
|
|
1224
|
+
* @throws FluxerError (or REST error) if user not found
|
|
1225
|
+
* @example
|
|
1226
|
+
* const { user, globalProfile, serverProfile, member } = await client.users.fetchWithProfile(
|
|
1227
|
+
* userId,
|
|
1228
|
+
* { guildId: message.guildId ?? undefined },
|
|
1229
|
+
* );
|
|
1230
|
+
*/
|
|
1231
|
+
fetchWithProfile(userId: string, options?: {
|
|
1232
|
+
guildId?: string | null;
|
|
1233
|
+
}): Promise<FetchedUserWithProfile>;
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1109
1236
|
/**
|
|
1110
1237
|
* Callback parameter types for client events. Use with client.on(Events.X, handler).
|
|
1111
1238
|
* @see Events
|
|
@@ -1197,7 +1324,7 @@ declare class Client extends EventEmitter {
|
|
|
1197
1324
|
readonly rest: REST;
|
|
1198
1325
|
readonly guilds: GuildManager;
|
|
1199
1326
|
readonly channels: ChannelManager;
|
|
1200
|
-
readonly users:
|
|
1327
|
+
readonly users: UsersManager;
|
|
1201
1328
|
/** Typed event handlers. Use client.events.MessageReactionAdd((reaction, user, messageId, channelId, emoji, userId) => {...}) or client.on(Events.MessageReactionAdd, ...). */
|
|
1202
1329
|
readonly events: ClientEventMethods;
|
|
1203
1330
|
/** The authenticated bot user. Null until READY is received. */
|
|
@@ -1338,6 +1465,7 @@ declare const ErrorCodes: {
|
|
|
1338
1465
|
readonly MessageNotFound: "MESSAGE_NOT_FOUND";
|
|
1339
1466
|
readonly GuildNotFound: "GUILD_NOT_FOUND";
|
|
1340
1467
|
readonly MemberNotFound: "MEMBER_NOT_FOUND";
|
|
1468
|
+
readonly RoleNotFound: "ROLE_NOT_FOUND";
|
|
1341
1469
|
};
|
|
1342
1470
|
|
|
1343
1471
|
interface CdnUrlOptions {
|
|
@@ -1401,4 +1529,4 @@ declare function cdnMemberBannerURL(guildId: string, userId: string, bannerHash:
|
|
|
1401
1529
|
*/
|
|
1402
1530
|
declare function cdnDefaultAvatarURL(discriminatorIndex?: number): string;
|
|
1403
1531
|
|
|
1404
|
-
export { Base, CategoryChannel, type CdnUrlOptions, Channel, ChannelManager, Client, type ClientEventMethods, type ClientEvents, ClientUser, type CollectedReaction, DMChannel, ErrorCodes, Events, FluxerError, type FluxerErrorOptions, Guild, GuildBan, GuildChannel, GuildEmoji, GuildMember, GuildSticker, Invite, LinkChannel, Message, MessageCollector, type MessageCollectorEndReason, type MessageCollectorOptions, type MessageEditOptions, MessageManager, MessageReaction, type MessageSendOptions, type PartialMessage, ReactionCollector, type ReactionCollectorEndReason, type ReactionCollectorOptions, Role, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions, cdnAvatarURL, cdnBannerURL, cdnDefaultAvatarURL, cdnDisplayAvatarURL, cdnMemberAvatarURL, cdnMemberBannerURL };
|
|
1532
|
+
export { Base, CategoryChannel, type CdnUrlOptions, Channel, ChannelManager, Client, type ClientEventMethods, type ClientEvents, ClientUser, type CollectedReaction, DMChannel, ErrorCodes, Events, type FetchedUserWithProfile, FluxerError, type FluxerErrorOptions, Guild, GuildBan, GuildChannel, GuildEmoji, GuildMember, GuildMemberManager, GuildSticker, Invite, LinkChannel, Message, MessageCollector, type MessageCollectorEndReason, type MessageCollectorOptions, type MessageEditOptions, MessageManager, MessageReaction, type MessageSendOptions, type PartialMessage, ReactionCollector, type ReactionCollectorEndReason, type ReactionCollectorOptions, Role, TextChannel, User, UsersManager, VoiceChannel, Webhook, type WebhookSendOptions, cdnAvatarURL, cdnBannerURL, cdnDefaultAvatarURL, cdnDisplayAvatarURL, cdnMemberAvatarURL, cdnMemberBannerURL };
|