@zhin.js/adapter-discord 1.0.8 → 1.0.9

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +28 -16
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @zhin.js/adapter-discord
2
2
 
3
+ ## 1.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - c490260: fix: 更新脚手架结构,优化包依赖
8
+ - zhin.js@1.0.9
9
+
3
10
  ## 1.0.8
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -13,29 +13,41 @@ pnpm add @zhin.js/adapter-discord
13
13
  ### Gateway 模式配置(推荐常规使用)
14
14
 
15
15
  ```typescript
16
- import { DiscordBotConfig } from '@zhin.js/adapter-discord';
16
+ // zhin.config.ts
17
+ import { defineConfig } from 'zhin.js'
17
18
 
18
- const config: DiscordBotConfig = {
19
- context: 'discord',
20
- name: 'my-discord-bot',
21
- token: 'YOUR_BOT_TOKEN', // 从 Discord Developer Portal 获取的 Bot Token
22
- }
19
+ export default defineConfig({
20
+ bots: [
21
+ {
22
+ context: 'discord',
23
+ name: 'my-discord-bot',
24
+ token: process.env.DISCORD_TOKEN, // 从 Discord Developer Portal 获取的 Bot Token
25
+ }
26
+ ],
27
+ plugins: ['adapter-discord']
28
+ })
23
29
  ```
24
30
 
25
31
  ### Interactions 端点模式配置(推荐高性能场景)
26
32
 
27
33
  ```typescript
28
- import { DiscordInteractionsConfig } from '@zhin.js/adapter-discord';
34
+ // zhin.config.ts
35
+ import { defineConfig } from 'zhin.js'
29
36
 
30
- const config: DiscordInteractionsConfig = {
31
- context: 'discord-interactions',
32
- name: 'my-discord-bot',
33
- token: 'YOUR_BOT_TOKEN',
34
- applicationId: 'YOUR_APPLICATION_ID', // Discord 应用 ID
35
- publicKey: 'YOUR_PUBLIC_KEY', // Discord 应用的 Public Key
36
- interactionsPath: '/discord/interactions', // 交互端点路径
37
- useGateway: false // 是否同时使用 Gateway(可选)
38
- }
37
+ export default defineConfig({
38
+ bots: [
39
+ {
40
+ context: 'discord-interactions',
41
+ name: 'my-discord-bot',
42
+ token: process.env.DISCORD_TOKEN,
43
+ applicationId: process.env.DISCORD_APPLICATION_ID, // Discord 应用 ID
44
+ publicKey: process.env.DISCORD_PUBLIC_KEY, // Discord 应用的 Public Key
45
+ interactionsPath: '/discord/interactions', // 交互端点路径
46
+ useGateway: false // 是否同时使用 Gateway(可选)
47
+ }
48
+ ],
49
+ plugins: ['adapter-discord']
50
+ })
39
51
  ```
40
52
 
41
53
  ### 通用配置参数
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-discord",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "zhin adapter for discord",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@zhin.js/types": "1.0.3",
30
- "zhin.js": "1.0.8"
30
+ "zhin.js": "1.0.9"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  "@zhin.js/types": {