@fluxerjs/core 1.0.7 → 1.0.8
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-OSOB6ELO.mjs → Channel-TWPDKW2P.mjs} +1 -1
- package/dist/{ClientUser-RNDKHQ3Z.mjs → ClientUser-2K2BACK7.mjs} +1 -2
- package/dist/{Guild-GOQZ7XP4.mjs → Guild-CMZGA6DW.mjs} +3 -1
- package/dist/{GuildMember-BJJNCL6W.mjs → GuildMember-DW2N6ITI.mjs} +1 -2
- package/dist/{Message-QXPHQOVC.mjs → Message-G2QIKZQK.mjs} +1 -2
- package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
- package/dist/{Webhook-AG6QFM2I.mjs → Role-SVLWIAMN.mjs} +3 -3
- package/dist/{Webhook-2RHBXH7R.mjs → Webhook-2MQESB7Z.mjs} +1 -1
- package/dist/{chunk-J3EIGOXQ.mjs → chunk-4GCZFOS5.mjs} +20 -6
- package/dist/{chunk-PO5JZQVN.mjs → chunk-CO5EL5LH.mjs} +71 -14
- package/dist/{chunk-WYSHH4LR.mjs → chunk-CZIO2D7F.mjs} +72 -6
- package/dist/chunk-HBF5QEDH.mjs +42 -0
- package/dist/{chunk-NISGA2YZ.mjs → chunk-JVEOQFUX.mjs} +1 -4
- package/dist/chunk-SQVCCSNN.mjs +41 -0
- package/dist/chunk-TJVZEILY.mjs +120 -0
- package/dist/{chunk-T2NSVWBH.mjs → chunk-ZGMM6IPQ.mjs} +3 -1
- package/dist/index.d.mts +374 -61
- package/dist/index.d.ts +374 -61
- package/dist/index.js +1001 -409
- package/dist/index.mjs +505 -192
- package/package.json +27 -8
- package/dist/Channel-2WNJ445K.mjs +0 -17
- package/dist/Channel-BEZOW4VC.mjs +0 -17
- package/dist/Channel-DPLLHL7Y.mjs +0 -19
- package/dist/Channel-HM2UY4DN.mjs +0 -17
- package/dist/Channel-IKL3SJXN.mjs +0 -17
- package/dist/Channel-KILNV5V3.mjs +0 -17
- package/dist/Channel-KOTARBSF.mjs +0 -17
- package/dist/Channel-ON7O3D3M.mjs +0 -17
- package/dist/Channel-TOAQGSRX.mjs +0 -17
- package/dist/Channel-VENHOL7S.mjs +0 -17
- package/dist/Channel-YVGPVOVB.mjs +0 -17
- package/dist/ClientUser-6HBAPU6H.mjs +0 -8
- package/dist/ClientUser-ALGC4FNY.mjs +0 -8
- package/dist/ClientUser-J6HQVSDJ.mjs +0 -9
- package/dist/ClientUser-LLL6WX35.mjs +0 -8
- package/dist/ClientUser-N7ZXYAQ3.mjs +0 -8
- package/dist/Guild-36EGAAEW.mjs +0 -8
- package/dist/Guild-5UBZNIGD.mjs +0 -9
- package/dist/Guild-CA3W6DOD.mjs +0 -8
- package/dist/Guild-GIXJJBFM.mjs +0 -9
- package/dist/Guild-NHNQ5TIA.mjs +0 -8
- package/dist/Guild-S436SLOP.mjs +0 -9
- package/dist/Guild-WAFXK2EX.mjs +0 -9
- package/dist/Guild-XPOMHZZG.mjs +0 -9
- package/dist/Guild-ZOFF5LFR.mjs +0 -8
- package/dist/GuildMember-FX2JAWES.mjs +0 -8
- package/dist/GuildMember-K5FLBNHV.mjs +0 -8
- package/dist/GuildMember-RGVPVUAG.mjs +0 -9
- package/dist/GuildMember-UBNHZBCO.mjs +0 -8
- package/dist/GuildMember-UU26WJGN.mjs +0 -8
- package/dist/GuildMember-XF7K2R45.mjs +0 -9
- package/dist/Message-23Z3RPCZ.mjs +0 -9
- package/dist/Message-33APPS76.mjs +0 -9
- package/dist/Message-6RSAGIRP.mjs +0 -8
- package/dist/Message-OXTQHFCF.mjs +0 -8
- package/dist/Message-PZUU7ZFR.mjs +0 -9
- package/dist/Message-R7GZYIQQ.mjs +0 -8
- package/dist/Message-W624MHJF.mjs +0 -8
- package/dist/Message-XB5WNMHL.mjs +0 -9
- package/dist/Message-ZCS7IGJX.mjs +0 -8
- package/dist/Webhook-NUQCJAWZ.mjs +0 -7
- package/dist/Webhook-TGAZZRQQ.mjs +0 -7
- package/dist/chunk-2FIZRRSO.mjs +0 -88
- package/dist/chunk-3CNUPFDI.mjs +0 -59
- package/dist/chunk-4DBGMFOQ.mjs +0 -14
- package/dist/chunk-5HQRX3KJ.mjs +0 -70
- package/dist/chunk-62S4AB2S.mjs +0 -54
- package/dist/chunk-6CEMF2LO.mjs +0 -14
- package/dist/chunk-6EBNOON4.mjs +0 -86
- package/dist/chunk-72OY7B3D.mjs +0 -72
- package/dist/chunk-7FYM4D2E.mjs +0 -50
- package/dist/chunk-7GZN6JXT.mjs +0 -50
- package/dist/chunk-7H3TKJUT.mjs +0 -53
- package/dist/chunk-7SIS5CUA.mjs +0 -14
- package/dist/chunk-BGJSL6JI.mjs +0 -14
- package/dist/chunk-BUEXP5SZ.mjs +0 -70
- package/dist/chunk-BYTAODAO.mjs +0 -70
- package/dist/chunk-CQ5ZVTLX.mjs +0 -71
- package/dist/chunk-DJBCSVZX.mjs +0 -102
- package/dist/chunk-DLROMCIJ.mjs +0 -50
- package/dist/chunk-DPZHAYCK.mjs +0 -71
- package/dist/chunk-E75ZVY3I.mjs +0 -14
- package/dist/chunk-EF32ILJL.mjs +0 -102
- package/dist/chunk-F2EEQP5O.mjs +0 -86
- package/dist/chunk-FK5X6HFL.mjs +0 -111
- package/dist/chunk-FNFID6QB.mjs +0 -45
- package/dist/chunk-G4L7WAJS.mjs +0 -64
- package/dist/chunk-GUNWHOQO.mjs +0 -42
- package/dist/chunk-IPHFDI2L.mjs +0 -68
- package/dist/chunk-JJHZBWZM.mjs +0 -118
- package/dist/chunk-L25ON7WB.mjs +0 -52
- package/dist/chunk-LBBIQOSH.mjs +0 -53
- package/dist/chunk-LVMFPATK.mjs +0 -54
- package/dist/chunk-NOLYW3V4.mjs +0 -140
- package/dist/chunk-OHIHIQAS.mjs +0 -102
- package/dist/chunk-P4IRDGB4.mjs +0 -43
- package/dist/chunk-PYYXC7US.mjs +0 -76
- package/dist/chunk-QDCFQF6J.mjs +0 -36
- package/dist/chunk-QDNFJVVE.mjs +0 -70
- package/dist/chunk-QXJNV5EJ.mjs +0 -110
- package/dist/chunk-RXHJYGSJ.mjs +0 -53
- package/dist/chunk-SW6KNICI.mjs +0 -52
- package/dist/chunk-TE5IC7IP.mjs +0 -36
- package/dist/chunk-TMDZALIN.mjs +0 -110
- package/dist/chunk-WFONGZGK.mjs +0 -42
- package/dist/chunk-WZVY7DA6.mjs +0 -44
- package/dist/chunk-XTDZQD4A.mjs +0 -110
- package/dist/chunk-XXCBJJZE.mjs +0 -88
- package/dist/chunk-YKP7JHV2.mjs +0 -102
- package/dist/chunk-YSKZR66G.mjs +0 -102
- package/dist/chunk-ZHRQQZ4X.mjs +0 -102
- package/dist/chunk-ZMIMAMO2.mjs +0 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Collection } from '@fluxerjs/collection';
|
|
2
2
|
import * as _fluxerjs_types from '@fluxerjs/types';
|
|
3
|
-
import { APIWebhook, APIChannelPartial, ChannelType,
|
|
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';
|
|
4
4
|
export { GatewayOpcodes, Routes } from '@fluxerjs/types';
|
|
5
5
|
import { EmbedBuilder } from '@fluxerjs/builders';
|
|
6
6
|
export { AttachmentBuilder, EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
|
|
@@ -12,6 +12,24 @@ declare abstract class Base {
|
|
|
12
12
|
abstract readonly client: Client;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Manages messages for a channel. Access via channel.messages.
|
|
17
|
+
* @example
|
|
18
|
+
* const message = await channel.messages.fetch(messageId);
|
|
19
|
+
* if (message) await message.edit({ content: 'Updated!' });
|
|
20
|
+
*/
|
|
21
|
+
declare class MessageManager {
|
|
22
|
+
private readonly client;
|
|
23
|
+
private readonly channelId;
|
|
24
|
+
constructor(client: Client, channelId: string);
|
|
25
|
+
/**
|
|
26
|
+
* Fetch a message by ID from this channel.
|
|
27
|
+
* @param messageId - Snowflake of the message
|
|
28
|
+
* @returns The message, or null if not found
|
|
29
|
+
*/
|
|
30
|
+
fetch(messageId: string): Promise<Message | null>;
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
/** Options for sending a message via webhook. */
|
|
16
34
|
interface WebhookSendOptions {
|
|
17
35
|
/** Message text content */
|
|
@@ -72,6 +90,12 @@ declare class Webhook extends Base {
|
|
|
72
90
|
|
|
73
91
|
/** Base class for all channel types. */
|
|
74
92
|
declare abstract class Channel extends Base {
|
|
93
|
+
/** Whether this channel has a send method (TextChannel, DMChannel). */
|
|
94
|
+
isSendable(): this is TextChannel | DMChannel;
|
|
95
|
+
/** Whether this channel is a DM or Group DM. */
|
|
96
|
+
isDM(): boolean;
|
|
97
|
+
/** Whether this channel is voice-based (VoiceChannel). */
|
|
98
|
+
isVoice(): boolean;
|
|
75
99
|
/** Create a DM channel from API data (type DM or GroupDM). */
|
|
76
100
|
static createDM(client: Client, data: APIChannelPartial): DMChannel;
|
|
77
101
|
readonly client: Client;
|
|
@@ -85,6 +109,11 @@ declare abstract class Channel extends Base {
|
|
|
85
109
|
* @param data - Channel data from the API
|
|
86
110
|
*/
|
|
87
111
|
static from(client: Client, data: APIChannel | APIChannelPartial): GuildChannel | TextChannel | null;
|
|
112
|
+
/**
|
|
113
|
+
* Create a channel from API data, including DM and GroupDM.
|
|
114
|
+
* Used by ChannelManager.fetch() for GET /channels/{id}.
|
|
115
|
+
*/
|
|
116
|
+
static fromOrCreate(client: Client, data: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel | null;
|
|
88
117
|
}
|
|
89
118
|
declare class GuildChannel extends Channel {
|
|
90
119
|
readonly guildId: string;
|
|
@@ -121,6 +150,15 @@ declare class TextChannel extends GuildChannel {
|
|
|
121
150
|
content?: string;
|
|
122
151
|
embeds?: unknown[];
|
|
123
152
|
}): Promise<Message>;
|
|
153
|
+
/** Message manager for this channel. Use channel.messages.fetch(messageId). */
|
|
154
|
+
get messages(): MessageManager;
|
|
155
|
+
/**
|
|
156
|
+
* Fetch a message by ID from this channel.
|
|
157
|
+
* @param messageId - Snowflake of the message
|
|
158
|
+
* @returns The message, or null if not found
|
|
159
|
+
* @deprecated Use channel.messages.fetch(messageId) instead.
|
|
160
|
+
*/
|
|
161
|
+
fetchMessage(messageId: string): Promise<Message | null>;
|
|
124
162
|
}
|
|
125
163
|
declare class CategoryChannel extends GuildChannel {
|
|
126
164
|
}
|
|
@@ -146,6 +184,89 @@ declare class DMChannel extends Channel {
|
|
|
146
184
|
content?: string;
|
|
147
185
|
embeds?: unknown[];
|
|
148
186
|
}): Promise<Message>;
|
|
187
|
+
/** Message manager for this channel. Use channel.messages.fetch(messageId). */
|
|
188
|
+
get messages(): MessageManager;
|
|
189
|
+
/**
|
|
190
|
+
* Fetch a message by ID from this DM channel.
|
|
191
|
+
* @param messageId - Snowflake of the message
|
|
192
|
+
* @returns The message, or null if not found
|
|
193
|
+
* @deprecated Use channel.messages.fetch(messageId) instead.
|
|
194
|
+
*/
|
|
195
|
+
fetchMessage(messageId: string): Promise<Message | null>;
|
|
196
|
+
}
|
|
197
|
+
|
|
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[]>;
|
|
149
270
|
}
|
|
150
271
|
|
|
151
272
|
/** Options for editing a message (content and/or embeds). */
|
|
@@ -167,9 +288,35 @@ declare class Message extends Base {
|
|
|
167
288
|
readonly editedAt: Date | null;
|
|
168
289
|
pinned: boolean;
|
|
169
290
|
readonly attachments: Collection<string, APIMessageAttachment>;
|
|
170
|
-
|
|
291
|
+
/** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
|
|
292
|
+
get channel(): Channel | null;
|
|
293
|
+
/** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
|
|
294
|
+
get guild(): Guild | null;
|
|
171
295
|
/** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
|
|
172
296
|
constructor(client: Client, data: APIMessage);
|
|
297
|
+
/**
|
|
298
|
+
* Send a message to this channel without replying. Use when you want a standalone message.
|
|
299
|
+
* @param options - Text content or object with content and/or embeds
|
|
300
|
+
* @example
|
|
301
|
+
* await message.send('Pong!');
|
|
302
|
+
* await message.send({ embeds: [embed.toJSON()] });
|
|
303
|
+
*/
|
|
304
|
+
send(options: string | {
|
|
305
|
+
content?: string;
|
|
306
|
+
embeds?: APIEmbed[];
|
|
307
|
+
}): Promise<Message>;
|
|
308
|
+
/**
|
|
309
|
+
* Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
|
|
310
|
+
* @param channelId - Snowflake of the target channel (e.g. log channel ID)
|
|
311
|
+
* @param options - Text content or object with content and/or embeds
|
|
312
|
+
* @example
|
|
313
|
+
* await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
|
|
314
|
+
* await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
|
|
315
|
+
*/
|
|
316
|
+
sendTo(channelId: string, options: string | {
|
|
317
|
+
content?: string;
|
|
318
|
+
embeds?: APIEmbed[];
|
|
319
|
+
}): Promise<Message>;
|
|
173
320
|
/**
|
|
174
321
|
* Reply to this message.
|
|
175
322
|
* @param options - Text content or object with content and/or embeds
|
|
@@ -183,29 +330,41 @@ declare class Message extends Base {
|
|
|
183
330
|
* @param options - New content and/or embeds
|
|
184
331
|
*/
|
|
185
332
|
edit(options: MessageEditOptions): Promise<Message>;
|
|
333
|
+
/**
|
|
334
|
+
* Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
|
|
335
|
+
* Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
|
|
336
|
+
* @returns The updated message, or null if deleted or not found
|
|
337
|
+
* @example
|
|
338
|
+
* const updated = await message.fetch();
|
|
339
|
+
* if (updated) console.log('Latest content:', updated.content);
|
|
340
|
+
*/
|
|
341
|
+
fetch(): Promise<Message | null>;
|
|
186
342
|
/** Delete this message. */
|
|
187
343
|
delete(): Promise<void>;
|
|
188
344
|
/**
|
|
189
345
|
* Format emoji for reaction API: unicode string or "name:id" for custom.
|
|
190
|
-
*
|
|
346
|
+
* For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
|
|
191
347
|
*/
|
|
192
348
|
private static formatEmoji;
|
|
349
|
+
private resolveEmojiForReaction;
|
|
193
350
|
/**
|
|
194
351
|
* Add a reaction to this message (as the bot).
|
|
195
|
-
* @param emoji - Unicode emoji
|
|
352
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
|
|
196
353
|
*/
|
|
197
354
|
react(emoji: string | {
|
|
198
355
|
name: string;
|
|
199
|
-
id
|
|
356
|
+
id?: string;
|
|
357
|
+
animated?: boolean;
|
|
200
358
|
}): Promise<void>;
|
|
201
359
|
/**
|
|
202
360
|
* Remove the bot's reaction, or a specific user's reaction if userId is provided.
|
|
203
|
-
* @param emoji - Unicode emoji
|
|
361
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
|
|
204
362
|
* @param userId - If provided, removes that user's reaction (requires moderator permissions)
|
|
205
363
|
*/
|
|
206
364
|
removeReaction(emoji: string | {
|
|
207
365
|
name: string;
|
|
208
|
-
id
|
|
366
|
+
id?: string;
|
|
367
|
+
animated?: boolean;
|
|
209
368
|
}, userId?: string): Promise<void>;
|
|
210
369
|
/**
|
|
211
370
|
* Remove all reactions from this message.
|
|
@@ -214,11 +373,12 @@ declare class Message extends Base {
|
|
|
214
373
|
removeAllReactions(): Promise<void>;
|
|
215
374
|
/**
|
|
216
375
|
* Remove all reactions of a specific emoji from this message.
|
|
217
|
-
* @param emoji - Unicode emoji
|
|
376
|
+
* @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
|
|
218
377
|
*/
|
|
219
378
|
removeReactionEmoji(emoji: string | {
|
|
220
379
|
name: string;
|
|
221
|
-
id
|
|
380
|
+
id?: string;
|
|
381
|
+
animated?: boolean;
|
|
222
382
|
}): Promise<void>;
|
|
223
383
|
}
|
|
224
384
|
|
|
@@ -233,6 +393,8 @@ declare class User extends Base {
|
|
|
233
393
|
readonly bot: boolean;
|
|
234
394
|
/** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
|
|
235
395
|
constructor(client: Client, data: APIUserPartial);
|
|
396
|
+
/** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
|
|
397
|
+
_patch(data: APIUserPartial): void;
|
|
236
398
|
/**
|
|
237
399
|
* Get the URL for this user's avatar.
|
|
238
400
|
* @param options - Optional `size` and `extension` (default: `png`)
|
|
@@ -262,36 +424,6 @@ declare class User extends Base {
|
|
|
262
424
|
}): Promise<Message>;
|
|
263
425
|
}
|
|
264
426
|
|
|
265
|
-
/** Represents a Fluxer guild (server). */
|
|
266
|
-
declare class Guild extends Base {
|
|
267
|
-
readonly client: Client;
|
|
268
|
-
readonly id: string;
|
|
269
|
-
name: string;
|
|
270
|
-
icon: string | null;
|
|
271
|
-
banner: string | null;
|
|
272
|
-
readonly ownerId: string;
|
|
273
|
-
members: Collection<string, GuildMember>;
|
|
274
|
-
channels: Collection<string, GuildChannel>;
|
|
275
|
-
/** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
|
|
276
|
-
constructor(client: Client, data: APIGuild);
|
|
277
|
-
/** Get the guild icon URL, or null if no icon. */
|
|
278
|
-
iconURL(options?: {
|
|
279
|
-
size?: number;
|
|
280
|
-
}): string | null;
|
|
281
|
-
/** Get the guild banner URL, or null if no banner. */
|
|
282
|
-
bannerURL(options?: {
|
|
283
|
-
size?: number;
|
|
284
|
-
}): string | null;
|
|
285
|
-
/**
|
|
286
|
-
* Fetch a guild member by user ID.
|
|
287
|
-
* @param userId - The user ID of the member to fetch
|
|
288
|
-
* @returns The guild member, or null if not found
|
|
289
|
-
*/
|
|
290
|
-
fetchMember(userId: string): Promise<GuildMember | null>;
|
|
291
|
-
/** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
|
|
292
|
-
fetchWebhooks(): Promise<Webhook[]>;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
427
|
/** Represents a member of a guild. */
|
|
296
428
|
declare class GuildMember extends Base {
|
|
297
429
|
readonly client: Client;
|
|
@@ -322,6 +454,95 @@ declare class GuildMember extends Base {
|
|
|
322
454
|
removeRole(roleId: string): Promise<void>;
|
|
323
455
|
}
|
|
324
456
|
|
|
457
|
+
/** Represents a reaction added to or removed from a message. */
|
|
458
|
+
declare class MessageReaction extends Base {
|
|
459
|
+
readonly client: Client;
|
|
460
|
+
readonly messageId: string;
|
|
461
|
+
readonly channelId: string;
|
|
462
|
+
readonly guildId: string | null;
|
|
463
|
+
readonly emoji: GatewayReactionEmoji;
|
|
464
|
+
/** Raw gateway payload for low-level access. */
|
|
465
|
+
readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
|
|
466
|
+
constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
|
|
467
|
+
/** Emoji as a string: unicode or "name:id" for custom. */
|
|
468
|
+
get emojiIdentifier(): string;
|
|
469
|
+
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
470
|
+
get guild(): Guild | null;
|
|
471
|
+
/**
|
|
472
|
+
* Fetch the message this reaction belongs to.
|
|
473
|
+
* Use when you need to edit, delete, or otherwise interact with the message.
|
|
474
|
+
*/
|
|
475
|
+
fetchMessage(): Promise<Message | null>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/** Minimal message data for MessageDelete when the full message is not available. */
|
|
479
|
+
interface PartialMessage {
|
|
480
|
+
id: string;
|
|
481
|
+
channelId: string;
|
|
482
|
+
channel?: Channel | null;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Manages channels with fetch and send.
|
|
487
|
+
* Extends Collection so you can use .get(), .set(), .filter(), etc.
|
|
488
|
+
*/
|
|
489
|
+
declare class ChannelManager extends Collection<string, Channel> {
|
|
490
|
+
private readonly client;
|
|
491
|
+
constructor(client: Client);
|
|
492
|
+
/**
|
|
493
|
+
* Fetch a channel by ID from the API (or return from cache if present).
|
|
494
|
+
* @param channelId - Snowflake of the channel
|
|
495
|
+
* @returns The channel, or null if not found
|
|
496
|
+
* @example
|
|
497
|
+
* const channel = await client.channels.fetch(channelId);
|
|
498
|
+
* if (channel?.isSendable()) await channel.send('Hello!');
|
|
499
|
+
*/
|
|
500
|
+
fetch(channelId: string): Promise<Channel | null>;
|
|
501
|
+
/**
|
|
502
|
+
* Fetch a message by ID from the API.
|
|
503
|
+
* @param channelId - Snowflake of the channel
|
|
504
|
+
* @param messageId - Snowflake of the message
|
|
505
|
+
* @returns The message, or null if not found
|
|
506
|
+
* @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.fetch(channelId))?.messages?.fetch(messageId).
|
|
507
|
+
* @example
|
|
508
|
+
* const channel = await client.channels.fetch(channelId);
|
|
509
|
+
* const message = await channel?.messages?.fetch(messageId);
|
|
510
|
+
*/
|
|
511
|
+
fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
|
|
512
|
+
/**
|
|
513
|
+
* Send a message to a channel by ID. Works even when the channel is not cached.
|
|
514
|
+
* Skips the fetch when you only need to send.
|
|
515
|
+
* @param channelId - Snowflake of the channel (text channel or DM)
|
|
516
|
+
* @param payload - Text content or object with content and/or embeds
|
|
517
|
+
* @returns The created message
|
|
518
|
+
* @example
|
|
519
|
+
* await client.channels.send(logChannelId, 'User joined!');
|
|
520
|
+
* await client.channels.send(channelId, { embeds: [embed.toJSON()] });
|
|
521
|
+
*/
|
|
522
|
+
send(channelId: string, payload: string | {
|
|
523
|
+
content?: string;
|
|
524
|
+
embeds?: _fluxerjs_types.APIEmbed[];
|
|
525
|
+
}): Promise<Message>;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Manages guilds with fetch.
|
|
530
|
+
* Extends Collection so you can use .get(), .set(), .filter(), etc.
|
|
531
|
+
*/
|
|
532
|
+
declare class GuildManager extends Collection<string, Guild> {
|
|
533
|
+
private readonly client;
|
|
534
|
+
constructor(client: Client);
|
|
535
|
+
/**
|
|
536
|
+
* Fetch a guild by ID from the API (or return from cache if present).
|
|
537
|
+
* @param guildId - Snowflake of the guild
|
|
538
|
+
* @returns The guild, or null if not found
|
|
539
|
+
* @example
|
|
540
|
+
* const guild = await client.guilds.fetch(guildId);
|
|
541
|
+
* if (guild) console.log(guild.name);
|
|
542
|
+
*/
|
|
543
|
+
fetch(guildId: string): Promise<Guild | null>;
|
|
544
|
+
}
|
|
545
|
+
|
|
325
546
|
interface ClientOptions {
|
|
326
547
|
rest?: Partial<ConstructorParameters<typeof REST>[0]>;
|
|
327
548
|
intents?: number;
|
|
@@ -347,6 +568,7 @@ declare const Events: {
|
|
|
347
568
|
readonly MessageCreate: "messageCreate";
|
|
348
569
|
readonly MessageUpdate: "messageUpdate";
|
|
349
570
|
readonly MessageDelete: "messageDelete";
|
|
571
|
+
readonly MessageDeleteBulk: "messageDeleteBulk";
|
|
350
572
|
readonly MessageReactionAdd: "messageReactionAdd";
|
|
351
573
|
readonly MessageReactionRemove: "messageReactionRemove";
|
|
352
574
|
readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
|
|
@@ -355,15 +577,34 @@ declare const Events: {
|
|
|
355
577
|
readonly GuildCreate: "guildCreate";
|
|
356
578
|
readonly GuildUpdate: "guildUpdate";
|
|
357
579
|
readonly GuildDelete: "guildDelete";
|
|
358
|
-
readonly
|
|
359
|
-
readonly
|
|
360
|
-
readonly
|
|
580
|
+
readonly GuildBanAdd: "guildBanAdd";
|
|
581
|
+
readonly GuildBanRemove: "guildBanRemove";
|
|
582
|
+
readonly GuildEmojisUpdate: "guildEmojisUpdate";
|
|
583
|
+
readonly GuildStickersUpdate: "guildStickersUpdate";
|
|
584
|
+
readonly GuildIntegrationsUpdate: "guildIntegrationsUpdate";
|
|
361
585
|
readonly GuildMemberAdd: "guildMemberAdd";
|
|
362
586
|
readonly GuildMemberUpdate: "guildMemberUpdate";
|
|
363
587
|
readonly GuildMemberRemove: "guildMemberRemove";
|
|
588
|
+
readonly GuildRoleCreate: "guildRoleCreate";
|
|
589
|
+
readonly GuildRoleUpdate: "guildRoleUpdate";
|
|
590
|
+
readonly GuildRoleDelete: "guildRoleDelete";
|
|
591
|
+
readonly GuildScheduledEventCreate: "guildScheduledEventCreate";
|
|
592
|
+
readonly GuildScheduledEventUpdate: "guildScheduledEventUpdate";
|
|
593
|
+
readonly GuildScheduledEventDelete: "guildScheduledEventDelete";
|
|
594
|
+
readonly ChannelCreate: "channelCreate";
|
|
595
|
+
readonly ChannelUpdate: "channelUpdate";
|
|
596
|
+
readonly ChannelDelete: "channelDelete";
|
|
597
|
+
readonly ChannelPinsUpdate: "channelPinsUpdate";
|
|
598
|
+
readonly InviteCreate: "inviteCreate";
|
|
599
|
+
readonly InviteDelete: "inviteDelete";
|
|
600
|
+
readonly TypingStart: "typingStart";
|
|
601
|
+
readonly UserUpdate: "userUpdate";
|
|
602
|
+
readonly PresenceUpdate: "presenceUpdate";
|
|
364
603
|
readonly VoiceStateUpdate: "voiceStateUpdate";
|
|
365
604
|
readonly VoiceServerUpdate: "voiceServerUpdate";
|
|
366
605
|
readonly VoiceStatesSync: "voiceStatesSync";
|
|
606
|
+
readonly WebhooksUpdate: "webhooksUpdate";
|
|
607
|
+
readonly Resumed: "resumed";
|
|
367
608
|
readonly Error: "error";
|
|
368
609
|
readonly Debug: "debug";
|
|
369
610
|
};
|
|
@@ -371,16 +612,24 @@ declare const Events: {
|
|
|
371
612
|
interface ClientEvents {
|
|
372
613
|
[Events.Ready]: [];
|
|
373
614
|
[Events.MessageCreate]: [message: Message];
|
|
374
|
-
[Events.MessageUpdate]: [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
[Events.MessageReactionAdd]: [
|
|
380
|
-
|
|
615
|
+
[Events.MessageUpdate]: [
|
|
616
|
+
oldMessage: Message | null,
|
|
617
|
+
newMessage: Message
|
|
618
|
+
];
|
|
619
|
+
[Events.MessageDelete]: [message: PartialMessage];
|
|
620
|
+
[Events.MessageReactionAdd]: [
|
|
621
|
+
reaction: MessageReaction,
|
|
622
|
+
user: User
|
|
623
|
+
];
|
|
624
|
+
[Events.MessageReactionRemove]: [
|
|
625
|
+
reaction: MessageReaction,
|
|
626
|
+
user: User
|
|
627
|
+
];
|
|
381
628
|
[Events.MessageReactionRemoveAll]: [data: GatewayMessageReactionRemoveAllDispatchData];
|
|
382
629
|
[Events.MessageReactionRemoveEmoji]: [data: GatewayMessageReactionRemoveEmojiDispatchData];
|
|
383
|
-
[Events.InteractionCreate]: [
|
|
630
|
+
[Events.InteractionCreate]: [
|
|
631
|
+
interaction: _fluxerjs_types.APIApplicationCommandInteraction
|
|
632
|
+
];
|
|
384
633
|
[Events.GuildCreate]: [guild: Guild];
|
|
385
634
|
[Events.GuildUpdate]: [oldGuild: Guild, newGuild: Guild];
|
|
386
635
|
[Events.GuildDelete]: [guild: Guild];
|
|
@@ -388,17 +637,44 @@ interface ClientEvents {
|
|
|
388
637
|
[Events.ChannelUpdate]: [oldChannel: Channel, newChannel: Channel];
|
|
389
638
|
[Events.ChannelDelete]: [channel: Channel];
|
|
390
639
|
[Events.GuildMemberAdd]: [member: GuildMember];
|
|
391
|
-
[Events.GuildMemberUpdate]: [
|
|
640
|
+
[Events.GuildMemberUpdate]: [
|
|
641
|
+
oldMember: GuildMember,
|
|
642
|
+
newMember: GuildMember
|
|
643
|
+
];
|
|
392
644
|
[Events.GuildMemberRemove]: [member: GuildMember];
|
|
393
645
|
[Events.VoiceStateUpdate]: [data: GatewayVoiceStateUpdateDispatchData];
|
|
394
646
|
[Events.VoiceServerUpdate]: [data: GatewayVoiceServerUpdateDispatchData];
|
|
395
|
-
[Events.VoiceStatesSync]: [
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
647
|
+
[Events.VoiceStatesSync]: [
|
|
648
|
+
data: {
|
|
649
|
+
guildId: string;
|
|
650
|
+
voiceStates: Array<{
|
|
651
|
+
user_id: string;
|
|
652
|
+
channel_id: string | null;
|
|
653
|
+
}>;
|
|
654
|
+
}
|
|
655
|
+
];
|
|
656
|
+
[Events.MessageDeleteBulk]: [
|
|
657
|
+
data: _fluxerjs_types.GatewayMessageDeleteBulkDispatchData
|
|
658
|
+
];
|
|
659
|
+
[Events.GuildBanAdd]: [data: _fluxerjs_types.GatewayGuildBanAddDispatchData];
|
|
660
|
+
[Events.GuildBanRemove]: [data: _fluxerjs_types.GatewayGuildBanRemoveDispatchData];
|
|
661
|
+
[Events.GuildEmojisUpdate]: [data: unknown];
|
|
662
|
+
[Events.GuildStickersUpdate]: [data: unknown];
|
|
663
|
+
[Events.GuildIntegrationsUpdate]: [data: unknown];
|
|
664
|
+
[Events.GuildRoleCreate]: [data: _fluxerjs_types.GatewayGuildRoleCreateDispatchData];
|
|
665
|
+
[Events.GuildRoleUpdate]: [data: _fluxerjs_types.GatewayGuildRoleUpdateDispatchData];
|
|
666
|
+
[Events.GuildRoleDelete]: [data: _fluxerjs_types.GatewayGuildRoleDeleteDispatchData];
|
|
667
|
+
[Events.GuildScheduledEventCreate]: [data: unknown];
|
|
668
|
+
[Events.GuildScheduledEventUpdate]: [data: unknown];
|
|
669
|
+
[Events.GuildScheduledEventDelete]: [data: unknown];
|
|
670
|
+
[Events.ChannelPinsUpdate]: [data: unknown];
|
|
671
|
+
[Events.InviteCreate]: [data: unknown];
|
|
672
|
+
[Events.InviteDelete]: [data: unknown];
|
|
673
|
+
[Events.TypingStart]: [data: _fluxerjs_types.GatewayTypingStartDispatchData];
|
|
674
|
+
[Events.UserUpdate]: [data: _fluxerjs_types.GatewayUserUpdateDispatchData];
|
|
675
|
+
[Events.PresenceUpdate]: [data: unknown];
|
|
676
|
+
[Events.WebhooksUpdate]: [data: unknown];
|
|
677
|
+
[Events.Resumed]: [];
|
|
402
678
|
[Events.Error]: [error: Error];
|
|
403
679
|
[Events.Debug]: [message: string];
|
|
404
680
|
}
|
|
@@ -406,14 +682,51 @@ interface ClientEvents {
|
|
|
406
682
|
declare class Client extends EventEmitter {
|
|
407
683
|
readonly options: ClientOptions;
|
|
408
684
|
readonly rest: REST;
|
|
409
|
-
readonly guilds:
|
|
410
|
-
readonly channels:
|
|
685
|
+
readonly guilds: GuildManager;
|
|
686
|
+
readonly channels: ChannelManager;
|
|
411
687
|
readonly users: Collection<string, User>;
|
|
412
688
|
user: ClientUser | null;
|
|
413
689
|
readyAt: Date | null;
|
|
414
690
|
private _ws;
|
|
415
691
|
/** @param options - Token, REST config, WebSocket, presence, etc. */
|
|
416
692
|
constructor(options?: ClientOptions);
|
|
693
|
+
/**
|
|
694
|
+
* Resolve an emoji argument to the API format (unicode or "name:id").
|
|
695
|
+
* Supports: <:name:id>, :name:, name:id, { name, id }, unicode.
|
|
696
|
+
* When id is missing (e.g. :name:), fetches guild emojis if guildId provided.
|
|
697
|
+
* @param emoji - Emoji string or object
|
|
698
|
+
* @param guildId - Guild ID for resolving custom emoji by name (required when id is missing)
|
|
699
|
+
* @returns API-formatted string for reactions
|
|
700
|
+
*/
|
|
701
|
+
resolveEmoji(emoji: string | {
|
|
702
|
+
name: string;
|
|
703
|
+
id?: string;
|
|
704
|
+
animated?: boolean;
|
|
705
|
+
}, guildId?: string | null): Promise<string>;
|
|
706
|
+
/**
|
|
707
|
+
* Fetch a message by channel and message ID. Use when you have IDs (e.g. from a DB).
|
|
708
|
+
* @param channelId - Snowflake of the channel
|
|
709
|
+
* @param messageId - Snowflake of the message
|
|
710
|
+
* @returns The message, or null if not found
|
|
711
|
+
* @deprecated Use channel.messages.fetch(messageId). For IDs-only: (await client.channels.fetch(channelId))?.messages?.fetch(messageId)
|
|
712
|
+
* @example
|
|
713
|
+
* const channel = await client.channels.fetch(channelId);
|
|
714
|
+
* const message = await channel?.messages?.fetch(messageId);
|
|
715
|
+
*/
|
|
716
|
+
fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
|
|
717
|
+
/**
|
|
718
|
+
* Send a message to any channel by ID. Shorthand for client.channels.send().
|
|
719
|
+
* Works even when the channel is not cached.
|
|
720
|
+
*/
|
|
721
|
+
sendToChannel(channelId: string, payload: string | {
|
|
722
|
+
content?: string;
|
|
723
|
+
embeds?: _fluxerjs_types.APIEmbed[];
|
|
724
|
+
}): Promise<Message>;
|
|
725
|
+
/**
|
|
726
|
+
* Get or create a User from API data. Caches in client.users.
|
|
727
|
+
* Updates existing user's username, avatar, etc. when fresh data is provided.
|
|
728
|
+
*/
|
|
729
|
+
getOrCreateUser(data: APIUserPartial): User;
|
|
417
730
|
/** WebSocket manager. Throws if not logged in. */
|
|
418
731
|
get ws(): WebSocketManager;
|
|
419
732
|
/**
|
|
@@ -446,4 +759,4 @@ declare const ErrorCodes: {
|
|
|
446
759
|
readonly InvalidToken: "INVALID_TOKEN";
|
|
447
760
|
};
|
|
448
761
|
|
|
449
|
-
export { Base, CategoryChannel, Channel, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildChannel, GuildMember, LinkChannel, Message, type MessageEditOptions, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };
|
|
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 };
|