@discordjs/core 2.2.2 → 3.0.0-core-gateway-rl.1762368996-5fa92a1ea
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 +24 -11
- package/dist/http-only.d.mts +617 -287
- package/dist/http-only.d.ts +617 -287
- package/dist/http-only.js +816 -519
- package/dist/http-only.js.map +1 -1
- package/dist/http-only.mjs +817 -523
- package/dist/http-only.mjs.map +1 -1
- package/dist/index.d.mts +663 -288
- package/dist/index.d.ts +663 -288
- package/dist/index.js +951 -561
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +944 -557
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -22
package/README.md
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
</p>
|
|
6
6
|
<br />
|
|
7
7
|
<p>
|
|
8
|
-
<a href="https://discord.gg/djs"><img src="https://img.shields.io/
|
|
8
|
+
<a href="https://discord.gg/djs"><img src="https://img.shields.io/badge/join_us-on_discord-5865F2?logo=discord&logoColor=white" alt="Discord server" /></a>
|
|
9
9
|
<a href="https://www.npmjs.com/package/@discordjs/core"><img src="https://img.shields.io/npm/v/@discordjs/core.svg?maxAge=3600" alt="npm version" /></a>
|
|
10
10
|
<a href="https://www.npmjs.com/package/@discordjs/core"><img src="https://img.shields.io/npm/dt/@discordjs/core.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
11
|
-
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/
|
|
12
|
-
<a href="https://github.com/discordjs/discord.js/commits/main/packages/core"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fcore"
|
|
11
|
+
<a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/tests.yml/badge.svg" alt="Build status" /></a>
|
|
12
|
+
<a href="https://github.com/discordjs/discord.js/commits/main/packages/core"><img alt="Last commit." src="https://img.shields.io/github/last-commit/discordjs/discord.js?logo=github&logoColor=ffffff&path=packages%2Fcore" /></a>
|
|
13
|
+
<a href="https://opencollective.com/discordjs"><img src="https://img.shields.io/opencollective/backers/discordjs?maxAge=3600&logo=opencollective" alt="backers" /></a>
|
|
13
14
|
<a href="https://codecov.io/gh/discordjs/discord.js"><img src="https://codecov.io/gh/discordjs/discord.js/branch/main/graph/badge.svg?precision=2&flag=core" alt="Code coverage" /></a>
|
|
14
15
|
</p>
|
|
15
16
|
<p>
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
|
|
25
26
|
## Installation
|
|
26
27
|
|
|
27
|
-
**Node.js
|
|
28
|
+
**Node.js 22.12.0 or newer is required.**
|
|
28
29
|
|
|
29
30
|
```sh
|
|
30
31
|
npm install @discordjs/core
|
|
@@ -34,10 +35,19 @@ pnpm add @discordjs/core
|
|
|
34
35
|
|
|
35
36
|
## Example usage
|
|
36
37
|
|
|
38
|
+
These examples use [ES modules](https://nodejs.org/api/esm.html#enabling).
|
|
39
|
+
|
|
37
40
|
```ts
|
|
41
|
+
import {
|
|
42
|
+
Client,
|
|
43
|
+
GatewayDispatchEvents,
|
|
44
|
+
GatewayIntentBits,
|
|
45
|
+
InteractionType,
|
|
46
|
+
MessageFlags,
|
|
47
|
+
type RESTGetAPIGatewayBotResult,
|
|
48
|
+
} from '@discordjs/core';
|
|
38
49
|
import { REST } from '@discordjs/rest';
|
|
39
50
|
import { WebSocketManager } from '@discordjs/ws';
|
|
40
|
-
import { GatewayDispatchEvents, GatewayIntentBits, InteractionType, MessageFlags, Client } from '@discordjs/core';
|
|
41
51
|
|
|
42
52
|
// Create REST and WebSocket managers directly
|
|
43
53
|
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
|
|
@@ -45,7 +55,7 @@ const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
|
|
|
45
55
|
const gateway = new WebSocketManager({
|
|
46
56
|
token: process.env.DISCORD_TOKEN,
|
|
47
57
|
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
|
|
48
|
-
rest
|
|
58
|
+
fetchGatewayInformation: () => rest.get('/gateway/bot') as Promise<RESTGetAPIGatewayBotResult>,
|
|
49
59
|
});
|
|
50
60
|
|
|
51
61
|
// Create a client to emit relevant events.
|
|
@@ -71,6 +81,9 @@ gateway.connect();
|
|
|
71
81
|
## Independent REST API Usage
|
|
72
82
|
|
|
73
83
|
```ts
|
|
84
|
+
import { API } from '@discordjs/core/http-only';
|
|
85
|
+
import { REST } from '@discordjs/rest';
|
|
86
|
+
|
|
74
87
|
// Create REST instance
|
|
75
88
|
const rest = new REST({ version: '10' }).setToken(token);
|
|
76
89
|
|
|
@@ -88,7 +101,7 @@ const guild = await api.guilds.get('1234567891011');
|
|
|
88
101
|
- [Guide][guide] ([source][guide-source])
|
|
89
102
|
Also see the v13 to v14 [Update Guide][guide-update], which includes updated and removed items from the library.
|
|
90
103
|
- [discord.js Discord server][discord]
|
|
91
|
-
- [Discord
|
|
104
|
+
- [Discord Developers Discord server][discord-developers]
|
|
92
105
|
- [GitHub][source]
|
|
93
106
|
- [npm][npm]
|
|
94
107
|
- [Related libraries][related-libs]
|
|
@@ -106,11 +119,11 @@ If you don't understand something in the documentation, you are experiencing pro
|
|
|
106
119
|
[website]: https://discord.js.org
|
|
107
120
|
[website-source]: https://github.com/discordjs/discord.js/tree/main/apps/website
|
|
108
121
|
[documentation]: https://discord.js.org/docs/packages/core/stable
|
|
109
|
-
[guide]: https://discordjs.guide
|
|
110
|
-
[guide-source]: https://github.com/discordjs/guide
|
|
111
|
-
[guide-update]: https://discordjs.guide/additional-info/changes-in-v14
|
|
122
|
+
[guide]: https://discordjs.guide
|
|
123
|
+
[guide-source]: https://github.com/discordjs/discord.js/tree/main/apps/guide
|
|
124
|
+
[guide-update]: https://discordjs.guide/legacy/additional-info/changes-in-v14
|
|
112
125
|
[discord]: https://discord.gg/djs
|
|
113
|
-
[discord-
|
|
126
|
+
[discord-developers]: https://discord.gg/discord-developers
|
|
114
127
|
[source]: https://github.com/discordjs/discord.js/tree/main/packages/core
|
|
115
128
|
[npm]: https://www.npmjs.com/package/@discordjs/core
|
|
116
129
|
[related-libs]: https://discord.com/developers/docs/topics/community-resources#libraries
|