@fluxerjs/core 2.1.0 → 3.0.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/README.md CHANGED
@@ -10,10 +10,12 @@ pnpm add @fluxerjs/core
10
10
 
11
11
  ## Usage
12
12
 
13
+ Fluxer has no Discord-style gateway intents. Use `new Client()` (or pass cache / instance options only):
14
+
13
15
  ```javascript
14
16
  import { Client, Events } from '@fluxerjs/core';
15
17
 
16
- const client = new Client({ intents: 0 });
18
+ const client = new Client();
17
19
 
18
20
  client.on(Events.Ready, () => console.log('Ready'));
19
21
  client.on(Events.MessageCreate, async (m) => {
@@ -23,21 +25,44 @@ client.on(Events.MessageCreate, async (m) => {
23
25
  await client.login(process.env.FLUXER_BOT_TOKEN);
24
26
  ```
25
27
 
28
+ Docs: [https://fluxer.js.org](https://fluxer.js.org) (start at [Installation](https://fluxer.js.org/guides/installation/)).
29
+
30
+ ### Cache limits and sweeps
31
+
32
+ ```javascript
33
+ const client = new Client({
34
+ cache: { guilds: 100, messages: 25 }, // messages: false to disable
35
+ });
36
+
37
+ client.on(Events.Ready, () => console.log(client.cache.stats()));
38
+ client.cache.sweepMessages((msg) => Date.now() - msg.createdAt.getTime() > 3_600_000);
39
+ ```
40
+
41
+ See `examples/cache-bot.js` and the [Caching guide](https://fluxer.js.org/guides/caching/).
42
+
43
+ ## Next steps
44
+
45
+ - Guides: [Basic bot](https://fluxer.js.org/guides/basic-bot/), [Prefix commands](https://fluxer.js.org/guides/prefix-commands/), [Errors](https://fluxer.js.org/guides/errors/)
46
+ - Coming from discord.js: [From discord.js](https://fluxer.js.org/guides/from-discordjs/)
47
+ - For embeds, use `EmbedBuilder`. For voice, add `@fluxerjs/voice` (advanced / being reworked).
48
+
49
+ ## Advanced: self-hosting and multi-instance
50
+
26
51
  Self-hosted / multi-instance: use `Client.fromDiscovery(origin)` or `ClientOptions.instance`.
27
52
  **Beta:** `ClientCluster` (also `@fluxerjs/core/cluster`) can add/remove/restart independently-tokened
28
- runtimes without process restart — see `examples/multi-instance-bot.js`. API may change.
53
+ runtimes without process restart. See `examples/multi-instance-bot.js`. API may change.
29
54
  Supports `addAll()`, `restart(id, { token })` (token must be re-supplied), typed lifecycle events,
30
55
  and runtime `status` including `error` + `lastError`.
31
56
 
32
- For voice, add `@fluxerjs/voice`. For embeds, use `EmbedBuilder`.
57
+ Process sharding: [`@fluxerjs/sharding`](https://fluxer.js.org/guides/sharding/).
33
58
 
34
59
  ## Subpath imports (tree-shaking)
35
60
 
36
61
  Bundlers can pull smaller graphs when you import only what you need:
37
62
 
38
- - `@fluxerjs/core/client` — `Client`, `Events`, `ClientOptions`
39
- - `@fluxerjs/core/errors` — `FluxerError`, `ErrorCodes`
40
- - `@fluxerjs/core/message` — `Message`, `PartialMessage`, send/edit types
41
- - `@fluxerjs/core/cluster` — **beta** `ClientCluster` multi-runtime supervisor
63
+ - `@fluxerjs/core/client`: `Client`, `Events`, `ClientOptions`
64
+ - `@fluxerjs/core/errors`: `FluxerError`, `ErrorCodes`
65
+ - `@fluxerjs/core/message`: `Message`, `PartialMessage`, send/edit types
66
+ - `@fluxerjs/core/cluster`: **beta** `ClientCluster` multi-runtime supervisor
42
67
 
43
68
  Related: `@fluxerjs/types/routes` (route builders only), `@fluxerjs/rest/request-manager` (HTTP layer without the full `REST` facade).
@@ -0,0 +1,34 @@
1
+ /** Emoji / sticker SDK options. */
2
+ /** Options for creating a guild/pack emoji (`name` + base64 `image`). */
3
+ interface ExpressionCreateOptions {
4
+ name: string;
5
+ image: string;
6
+ }
7
+ /** Convert {@link ExpressionCreateOptions} to the emoji create wire body. */
8
+ declare function toEmojiCreateBody(options: ExpressionCreateOptions): Record<string, unknown>;
9
+ /** Options for editing a pack/guild emoji. */
10
+ interface ExpressionEditOptions {
11
+ name: string;
12
+ }
13
+ /** Convert {@link ExpressionEditOptions} to the emoji edit wire body. */
14
+ declare function toEmojiEditBody(options: ExpressionEditOptions): Record<string, unknown>;
15
+ /** Options for creating a pack/guild sticker. */
16
+ interface StickerCreateOptions {
17
+ name: string;
18
+ /** Base64 image data (`image` on the wire). */
19
+ file: string;
20
+ description?: string | null;
21
+ tags?: string[];
22
+ }
23
+ /** Options for editing a pack/guild sticker. */
24
+ interface StickerEditOptions {
25
+ name?: string;
26
+ description?: string | null;
27
+ tags?: string[];
28
+ }
29
+ /** Convert {@link StickerCreateOptions} to the sticker create wire body. */
30
+ declare function toStickerCreateBody(options: StickerCreateOptions): Record<string, unknown>;
31
+ /** Convert {@link StickerEditOptions} to the sticker edit wire body. */
32
+ declare function toStickerEditBody(options: StickerEditOptions): Record<string, unknown>;
33
+
34
+ export { type ExpressionCreateOptions as E, type StickerCreateOptions as S, toEmojiEditBody as a, toStickerCreateBody as b, toStickerEditBody as c, type ExpressionEditOptions as d, type StickerEditOptions as e, toEmojiCreateBody as t };
@@ -0,0 +1,34 @@
1
+ /** Emoji / sticker SDK options. */
2
+ /** Options for creating a guild/pack emoji (`name` + base64 `image`). */
3
+ interface ExpressionCreateOptions {
4
+ name: string;
5
+ image: string;
6
+ }
7
+ /** Convert {@link ExpressionCreateOptions} to the emoji create wire body. */
8
+ declare function toEmojiCreateBody(options: ExpressionCreateOptions): Record<string, unknown>;
9
+ /** Options for editing a pack/guild emoji. */
10
+ interface ExpressionEditOptions {
11
+ name: string;
12
+ }
13
+ /** Convert {@link ExpressionEditOptions} to the emoji edit wire body. */
14
+ declare function toEmojiEditBody(options: ExpressionEditOptions): Record<string, unknown>;
15
+ /** Options for creating a pack/guild sticker. */
16
+ interface StickerCreateOptions {
17
+ name: string;
18
+ /** Base64 image data (`image` on the wire). */
19
+ file: string;
20
+ description?: string | null;
21
+ tags?: string[];
22
+ }
23
+ /** Options for editing a pack/guild sticker. */
24
+ interface StickerEditOptions {
25
+ name?: string;
26
+ description?: string | null;
27
+ tags?: string[];
28
+ }
29
+ /** Convert {@link StickerCreateOptions} to the sticker create wire body. */
30
+ declare function toStickerCreateBody(options: StickerCreateOptions): Record<string, unknown>;
31
+ /** Convert {@link StickerEditOptions} to the sticker edit wire body. */
32
+ declare function toStickerEditBody(options: StickerEditOptions): Record<string, unknown>;
33
+
34
+ export { type ExpressionCreateOptions as E, type StickerCreateOptions as S, toEmojiEditBody as a, toStickerCreateBody as b, toStickerEditBody as c, type ExpressionEditOptions as d, type StickerEditOptions as e, toEmojiCreateBody as t };