@seedcord/gateway 0.7.4 → 0.8.0-next.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 +58 -11
- package/dist/index.d.mts +43 -37
- package/dist/index.mjs +199 -180
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -16
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedcord/gateway",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-next.0",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=24.11"
|
|
6
|
+
"node": ">=24.11",
|
|
7
|
+
"bun": ">=1.4.2"
|
|
7
8
|
},
|
|
8
9
|
"description": "Gateway transport for seedcord bots, using the discord.js client",
|
|
9
10
|
"keywords": [
|
|
@@ -41,30 +42,30 @@
|
|
|
41
42
|
],
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"discord.js": "^14.27.0",
|
|
44
|
-
"envapt": "^
|
|
45
|
+
"envapt": "^9.1.0",
|
|
45
46
|
"typescript": "^5.9.3 || ^6.0.0 || ^7.0.0"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
49
|
"@discordjs/builders": "^1.14.1",
|
|
49
50
|
"@discordjs/rest": "^2.6.3",
|
|
50
|
-
"@seedcord/core": "^0.
|
|
51
|
-
"@seedcord/custom-id": "^0.
|
|
52
|
-
"@seedcord/errors": "^0.
|
|
53
|
-
"@seedcord/event-emitter": "^0.1.
|
|
54
|
-
"@seedcord/logger": "^0.
|
|
55
|
-
"@seedcord/rate-limiter": "^0.1.
|
|
56
|
-
"@seedcord/types": "^0.
|
|
57
|
-
"@seedcord/utils": "^0.
|
|
51
|
+
"@seedcord/core": "^0.11.0-next.0",
|
|
52
|
+
"@seedcord/custom-id": "^0.3.0-next.0",
|
|
53
|
+
"@seedcord/errors": "^0.14.0-next.0",
|
|
54
|
+
"@seedcord/event-emitter": "^0.1.9-next.0",
|
|
55
|
+
"@seedcord/logger": "^0.5.0-next.0",
|
|
56
|
+
"@seedcord/rate-limiter": "^0.1.13-next.0",
|
|
57
|
+
"@seedcord/types": "^0.15.0-next.0",
|
|
58
|
+
"@seedcord/utils": "^0.9.0-next.0",
|
|
58
59
|
"reflect-metadata": "^0.2.2"
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
|
-
"@seedcord/eslint-config": "^2.
|
|
62
|
-
"@seedcord/tsconfig": "^2.0.
|
|
62
|
+
"@seedcord/eslint-config": "^2.5.1-next.0",
|
|
63
|
+
"@seedcord/tsconfig": "^2.0.7-next.0",
|
|
63
64
|
"@seedcord/tsdown-config": "^2.0.1",
|
|
64
65
|
"@seedcord/vitest-config": "^0.0.1",
|
|
65
66
|
"discord.js": "^14.27.0",
|
|
66
|
-
"envapt": "^
|
|
67
|
-
"type-fest": "^5.
|
|
67
|
+
"envapt": "^9.1.0",
|
|
68
|
+
"type-fest": "^5.9.0"
|
|
68
69
|
},
|
|
69
70
|
"publishConfig": {
|
|
70
71
|
"access": "public",
|
|
@@ -82,5 +83,5 @@
|
|
|
82
83
|
"test:watch": "vitest dev",
|
|
83
84
|
"coverage": "vitest run --coverage"
|
|
84
85
|
},
|
|
85
|
-
"readme": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.seedcord.org/assets/wordmark-dark.webp\" />\n <img src=\"https://cdn.seedcord.org/assets/wordmark-light.webp\" alt=\"seedcord\" width=\"440\" />\n </picture>\n</div>\n\n<div align=\"center\">\n <h3>The whole Discord bot, typed end to end</h3>\n <a href=\"https://seedcord.org\">Website</a> ·\n <a href=\"https://seedcord.org/guide\">Guide</a> ·\n <a href=\"https://seedcord.org/docs\">Reference</a> ·\n <a href=\"https://
|
|
86
|
+
"readme": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.seedcord.org/assets/wordmark-dark.webp\" />\n <img src=\"https://cdn.seedcord.org/assets/wordmark-light.webp\" alt=\"seedcord\" width=\"440\" />\n </picture>\n</div>\n\n<div align=\"center\">\n <h3>The whole Discord bot, typed end to end</h3>\n <a href=\"https://seedcord.org\">Website</a> ·\n <a href=\"https://seedcord.org/guide\">Guide</a> ·\n <a href=\"https://seedcord.org/docs\">Reference</a> ·\n <a href=\"https://seedcord.org/chat/\">Discord</a>\n</div>\n\n<br />\n\n<div align=\"center\">\n\n[](https://www.npmjs.com/package/@seedcord/gateway) [](https://nodejs.org) [](https://bun.com) [](LICENSE)\n\n</div>\n\n## About\n\n`@seedcord/gateway` is the transport for a gateway bot. It holds a websocket connection to Discord through the discord.js client, which also keeps the cache. That connection carries message, member, voice, and reaction events, and Discord only sends those over a websocket. Pick this transport when your bot reacts to any of them.\n\nA bot that only answers commands and components can use [`@seedcord/http`](https://www.npmjs.com/package/@seedcord/http) instead, which keeps no connection open and also runs on Cloudflare Workers.\n\nseedcord is pre-1.0, so a minor version can break your bot. Each release's changelog says what changed and how to update.\n\n## Installation\n\n`pnpm create seedcord` sets up a new bot. To add seedcord to an existing project:\n\n```sh\npnpm add @seedcord/gateway discord.js @discordjs/builders envapt\npnpm add -D seedcord vite typescript\n```\n\n`discord.js`, `envapt`, and `typescript` are peer dependencies. `seedcord` is the CLI that runs the bot in dev and builds it.\n\n## Usage\n\n`bot.ts` creates the bot and tells it where your handlers are:\n\n```ts\nimport { Seedcord } from '@seedcord/gateway';\nimport { GatewayIntentBits } from 'discord.js';\nimport { Converters, Envapter } from 'envapt';\n\nexport default new Seedcord({\n bot: {\n clientOptions: { intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] },\n interactions: { path: './handlers' },\n commands: {\n path: './commands',\n guilds: Envapter.getAs('TESTING_GUILD_IDS', Converters.array(), [])\n },\n events: { path: './events' }\n },\n subscribers: { path: null }\n});\n```\n\nRead your environment through [envapt](https://envapt.materwelon.dev), the way `TESTING_GUILD_IDS` is read above. seedcord loads your `.env` files into envapt, and reads `DISCORD_BOT_TOKEN` from it too. envapt also reads your shell's variables, while `process.env` misses everything in your `.env` files.\n\nA file in `events/` reacts to any discord.js client event. Its handler reads the same arguments discord.js passes to `client.on()`:\n\n```ts\nimport { EventHandler, RegisterEvent } from '@seedcord/gateway';\nimport { Events } from 'discord.js';\n\n@RegisterEvent([Events.MessageCreate])\nexport class Mentioned extends EventHandler<Events.MessageCreate> {\n public async execute(): Promise<void> {\n const [message] = this.event;\n if (message.mentions.users.has(message.client.user.id)) await message.reply('hey');\n }\n}\n```\n\nSlash commands, components, checks, and plugins work the same way as on http. The [guide](https://seedcord.org/guide) covers them.\n\n## What it adds over the core\n\nEverything in [`@seedcord/core`](https://www.npmjs.com/package/@seedcord/core), plus:\n\n- `Seedcord`, which connects to Discord and holds the discord.js client\n- handlers that read discord.js objects, like a `ChatInputCommandInteraction`\n- event handlers for every discord.js client event, through `EventHandler` and `@RegisterEvent`\n- `getConfirmation`, which shows buttons and waits for the answer in one `await`\n"
|
|
86
87
|
}
|