@fluxerjs/core 2.2.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 +21 -9
- package/dist/Expressions-Bdgo72qI.d.mts +34 -0
- package/dist/Expressions-Bdgo72qI.d.ts +34 -0
- package/dist/{SubpathMessage-D70lAT7N.d.mts → SubpathMessage-CjQBbVmb.d.mts} +1390 -1104
- package/dist/{SubpathMessage-D70lAT7N.d.ts → SubpathMessage-DNlKq2Nj.d.ts} +1390 -1104
- package/dist/Sudo-CFfbmis3.d.mts +453 -0
- package/dist/Sudo-CFfbmis3.d.ts +453 -0
- package/dist/client.d.mts +4 -3
- package/dist/client.d.ts +4 -3
- package/dist/client.js +1976 -1001
- package/dist/client.mjs +1768 -796
- package/dist/cluster.d.mts +4 -3
- package/dist/cluster.d.ts +4 -3
- package/dist/cluster.js +1898 -923
- package/dist/cluster.mjs +1770 -798
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1957 -1008
- package/dist/index.mjs +1797 -834
- package/dist/internal.d.mts +12 -0
- package/dist/internal.d.ts +12 -0
- package/dist/internal.js +449 -0
- package/dist/internal.mjs +398 -0
- package/dist/message.d.mts +4 -3
- package/dist/message.d.ts +4 -3
- package/dist/message.js +446 -93
- package/dist/message.mjs +446 -94
- package/package.json +13 -9
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(
|
|
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,6 +25,8 @@ 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
|
+
|
|
26
30
|
### Cache limits and sweeps
|
|
27
31
|
|
|
28
32
|
```javascript
|
|
@@ -31,26 +35,34 @@ const client = new Client({
|
|
|
31
35
|
});
|
|
32
36
|
|
|
33
37
|
client.on(Events.Ready, () => console.log(client.cache.stats()));
|
|
34
|
-
client.cache.sweepMessages((msg) => Date.now() -
|
|
38
|
+
client.cache.sweepMessages((msg) => Date.now() - msg.createdAt.getTime() > 3_600_000);
|
|
35
39
|
```
|
|
36
40
|
|
|
37
|
-
See `examples/cache-bot.js` and the [Caching guide](https://
|
|
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
|
|
38
50
|
|
|
39
51
|
Self-hosted / multi-instance: use `Client.fromDiscovery(origin)` or `ClientOptions.instance`.
|
|
40
52
|
**Beta:** `ClientCluster` (also `@fluxerjs/core/cluster`) can add/remove/restart independently-tokened
|
|
41
|
-
runtimes without process restart
|
|
53
|
+
runtimes without process restart. See `examples/multi-instance-bot.js`. API may change.
|
|
42
54
|
Supports `addAll()`, `restart(id, { token })` (token must be re-supplied), typed lifecycle events,
|
|
43
55
|
and runtime `status` including `error` + `lastError`.
|
|
44
56
|
|
|
45
|
-
|
|
57
|
+
Process sharding: [`@fluxerjs/sharding`](https://fluxer.js.org/guides/sharding/).
|
|
46
58
|
|
|
47
59
|
## Subpath imports (tree-shaking)
|
|
48
60
|
|
|
49
61
|
Bundlers can pull smaller graphs when you import only what you need:
|
|
50
62
|
|
|
51
|
-
- `@fluxerjs/core/client
|
|
52
|
-
- `@fluxerjs/core/errors
|
|
53
|
-
- `@fluxerjs/core/message
|
|
54
|
-
- `@fluxerjs/core/cluster
|
|
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
|
|
55
67
|
|
|
56
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 };
|