@koishi-ce/plugin-inspect 1.0.0 → 1.1.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 ADDED
@@ -0,0 +1,83 @@
1
+ # @koishi-ce/plugin-inspect
2
+
3
+ **简体中文** | [English](#english)
4
+
5
+ 消息检查插件,移植自上游 [koishijs/koishi](https://github.com/koishijs/koishi) 的 `plugins/common/inspect`。查看当前会话或所引用消息的元信息,包括平台名、消息 ID、频道 ID、群组 ID、用户 ID 与自身 ID。
6
+
7
+ ## 指令
8
+
9
+ | 指令 | 权限 | 说明 |
10
+ | --- | --- | --- |
11
+ | `inspect` | 1 | 查看用户、频道或消息的详细信息 |
12
+
13
+ - `inspect @user`:输出所 @ 的用户 ID。
14
+ - `inspect #channel`:输出所 # 的频道 ID。
15
+ - `inspect`:输出当前会话的元信息;若消息带有引用,则优先展示被引用消息的信息。
16
+
17
+ ## 配置项
18
+
19
+ 本插件无需配置。
20
+
21
+ ## 用法
22
+
23
+ ```bash
24
+ bun add @koishi-ce/plugin-inspect
25
+ ```
26
+
27
+ 也可以在控制台的插件市场中直接安装。随后在配置文件中启用:
28
+
29
+ ```yaml
30
+ plugins:
31
+ inspect: {}
32
+ ```
33
+
34
+ ## 备注
35
+
36
+ - 指令设置了 `captureQuote: false`,引用消息不被消费而是保留在会话对象上,因此能检查被引用消息的元信息。
37
+ - 无法解析的元素会提示「参数无法解析。」。
38
+
39
+ ## 许可证
40
+
41
+ [MIT](https://github.com/Koishi-CE/koishi/blob/main/LICENSE)。本包是上游 [koishijs/koishi](https://github.com/koishijs/koishi) 的社区再分发,版权归属见 [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE)。
42
+
43
+ ---
44
+
45
+ ## English
46
+
47
+ A message inspection plugin, ported from `plugins/common/inspect` of the upstream [koishijs/koishi](https://github.com/koishijs/koishi) repository. It shows the metadata of the current session or a quoted message: platform, message ID, channel ID, guild ID, user ID and self ID.
48
+
49
+ ## Commands
50
+
51
+ | Command | Authority | Description |
52
+ | --- | --- | --- |
53
+ | `inspect` | 1 | Inspect detailed information about a user, channel or message |
54
+
55
+ - `inspect @user`: print the ID of the mentioned user.
56
+ - `inspect #channel`: print the ID of the referenced channel.
57
+ - `inspect`: print the metadata of the current session; a quoted message takes precedence.
58
+
59
+ ## Configuration
60
+
61
+ None.
62
+
63
+ ## Usage
64
+
65
+ ```bash
66
+ bun add @koishi-ce/plugin-inspect
67
+ ```
68
+
69
+ The plugin can also be installed from the console plugin market, then enabled in the config file:
70
+
71
+ ```yaml
72
+ plugins:
73
+ inspect: {}
74
+ ```
75
+
76
+ ## Notes
77
+
78
+ - The command sets `captureQuote: false`, so the quote stays on the session object and can be inspected.
79
+ - Unparsable elements report an error.
80
+
81
+ ## License
82
+
83
+ [MIT](https://github.com/Koishi-CE/koishi/blob/main/LICENSE). This package is a community redistribution of upstream koishijs/koishi; see [NOTICE](https://github.com/Koishi-CE/koishi/blob/main/NOTICE) for attribution.
@@ -1,3 +1,6 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
6
  description: 查看用户、频道或消息的详细信息
package/lib/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { Context, Schema } from "@koishi-ce/koishi";
2
2
  //#region src/index.d.ts
3
- declare const name = "inspect";
3
+ export declare const name = "inspect";
4
4
  /** 配置项(当前无可用配置) */
5
- type Config = Record<never, never>;
6
- declare const Config: Schema<Config>;
7
- declare function apply(ctx: Context): void;
8
- //#endregion
9
- export { Config, apply, name };
5
+ export type Config = Record<never, never>;
6
+ export declare const Config: Schema<Config>;
7
+ export declare function apply(ctx: Context): void;
8
+ //#endregion
package/lib/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Schema, h } from "@koishi-ce/koishi";
2
- import zhCN from "./assets/zh-CN-Dm2KmiOI.yml";
2
+ import zhCN from "./assets/zh-CN-BY_5D7hi.yml";
3
3
  //#region src/index.ts
4
4
  /**
5
5
  * 消息检查插件(inspect)。
package/locales/de-DE.yml CHANGED
@@ -1,18 +1,21 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
- description: 查看用户、频道或消息的详细信息
6
+ description: Details zu Benutzern, Kanälen oder Nachrichten anzeigen
4
7
  usage: |-
5
8
  inspect @user
6
9
  inspect #channel
7
10
  inspect
8
11
  messages:
9
- invalid: 参数无法解析。
10
- user: 用户 ID:{id}
11
- channel: 频道 ID:{id}
12
+ invalid: Argumente konnten nicht analysiert werden.
13
+ user: 'Benutzer-ID: {id}'
14
+ channel: 'Kanal-ID: {id}'
12
15
  message: |-
13
- 平台名:{platform}
14
- 消息 ID:{messageId}
15
- 频道 ID:{channelId}
16
- 群组 ID:{guildId}
17
- 用户 ID:{userId}
18
- 自身 ID{selfId}
16
+ Plattformname: {platform}
17
+ Nachrichten-ID: {messageId}
18
+ Kanal-ID: {channelId}
19
+ Gruppen-ID: {guildId}
20
+ Benutzer-ID: {userId}
21
+ Eigene ID: {selfId}
package/locales/en-US.yml CHANGED
@@ -1,3 +1,6 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
6
  description: View details of users, channels or messages
package/locales/fr-FR.yml CHANGED
@@ -1,18 +1,21 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
- description: 查看用户、频道或消息的详细信息
6
+ description: Afficher les détails des utilisateurs, canaux ou messages
4
7
  usage: |-
5
8
  inspect @user
6
9
  inspect #channel
7
10
  inspect
8
11
  messages:
9
- invalid: 参数无法解析。
10
- user: 用户 ID:{id}
11
- channel: 频道 ID:{id}
12
+ invalid: Impossible d'analyser les arguments.
13
+ user: "Identifiant de l'utilisateur : {id}"
14
+ channel: 'Identifiant du canal : {id}'
12
15
  message: |-
13
- 平台名:{platform}
14
- 消息 ID:{messageId}
15
- 频道 ID:{channelId}
16
- 群组 ID:{guildId}
17
- 用户 ID:{userId}
18
- 自身 ID:{selfId}
16
+ Nom de la plateforme : {platform}
17
+ Identifiant du message : {messageId}
18
+ Identifiant du canal : {channelId}
19
+ Identifiant du groupe : {guildId}
20
+ Identifiant de l'utilisateur : {userId}
21
+ Identifiant propre : {selfId}
package/locales/ja-JP.yml CHANGED
@@ -1,18 +1,21 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
- description: 查看用户、频道或消息的详细信息
6
+ description: ユーザー、チャンネルまたはメッセージの詳細を表示
4
7
  usage: |-
5
8
  inspect @user
6
9
  inspect #channel
7
10
  inspect
8
11
  messages:
9
- invalid: 参数无法解析。
10
- user: 用户 ID:{id}
11
- channel: 频道 ID:{id}
12
+ invalid: 引数を解析できませんでした。
13
+ user: ユーザー ID:{id}
14
+ channel: チャンネル ID:{id}
12
15
  message: |-
13
- 平台名:{platform}
14
- 消息 ID:{messageId}
15
- 频道 ID:{channelId}
16
- 群组 ID:{guildId}
17
- 用户 ID:{userId}
16
+ プラットフォーム名:{platform}
17
+ メッセージ ID:{messageId}
18
+ チャンネル ID:{channelId}
19
+ グループ ID:{guildId}
20
+ ユーザー ID:{userId}
18
21
  自身 ID:{selfId}
package/locales/ru-RU.yml CHANGED
@@ -1,18 +1,21 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
- description: 查看用户、频道或消息的详细信息
6
+ description: Просмотреть подробную информацию о пользователях, каналах или сообщениях
4
7
  usage: |-
5
8
  inspect @user
6
9
  inspect #channel
7
10
  inspect
8
11
  messages:
9
- invalid: 参数无法解析。
10
- user: 'Идентификатор Пользователя: {id}'
11
- channel: Идентификатор Канала:{id}
12
+ invalid: Не удалось разобрать аргументы.
13
+ user: 'Идентификатор пользователя: {id}'
14
+ channel: 'Идентификатор канала: {id}'
12
15
  message: |-
13
- 平台名:{platform}
14
- 消息 ID:{messageId}
15
- 频道 ID:{channelId}
16
- 群组 ID:{guildId}
17
- 用户 ID:{userId}
18
- 自身 ID:{selfId}
16
+ Платформа: {platform}
17
+ Идентификатор сообщения: {messageId}
18
+ Идентификатор канала: {channelId}
19
+ Идентификатор группы: {guildId}
20
+ Идентификатор пользователя: {userId}
21
+ Собственный идентификатор: {selfId}
package/locales/zh-CN.yml CHANGED
@@ -1,3 +1,6 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
6
  description: 查看用户、频道或消息的详细信息
package/locales/zh-TW.yml CHANGED
@@ -1,3 +1,6 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+
1
4
  commands:
2
5
  inspect:
3
6
  description: 查看使用者、頻道或消息的詳細信息
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@koishi-ce/plugin-inspect",
3
3
  "description": "Inspect on any user, channel or message",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -49,11 +49,11 @@
49
49
  ]
50
50
  },
51
51
  "peerDependencies": {
52
- "koishi": "^4.18.11"
52
+ "@koishi-ce/koishi": "^1.0.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@koishi-ce/plugin-mock": "^1.0.0",
56
- "@koishi-ce/koishi": "^1.0.0"
56
+ "@koishi-ce/koishi": "^1.0.8"
57
57
  },
58
58
  "exports": {
59
59
  ".": {
package/src/index.test.ts CHANGED
@@ -1,8 +1,16 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026-present Koishi-CE contributors.
3
+
1
4
  /**
2
5
  * inspect 插件测试:验证当前会话、at / sharp 元素参数、
3
6
  * 非法参数与引用消息四类输入的元信息输出。
4
7
  */
5
- import { afterAll, beforeAll, describe, it } from "bun:test";
8
+ import {
9
+ afterAll,
10
+ beforeAll,
11
+ describe,
12
+ it,
13
+ } from "bun:test";
6
14
  import { Context } from "@koishi-ce/koishi";
7
15
  import mock from "@koishi-ce/plugin-mock";
8
16
  import * as inspect from "./index.ts";
@@ -34,9 +42,18 @@ describe("@koishi-ce/plugin-inspect", () => {
34
42
  ),
35
43
  );
36
44
 
37
- await client.shouldReply('inspect <at id="321"/>', "用户 ID:321");
38
- await client.shouldReply('inspect <sharp id="654"/>', "频道 ID:654");
39
- await client.shouldReply("inspect foobar", "参数无法解析。");
45
+ await client.shouldReply(
46
+ 'inspect <at id="321"/>',
47
+ "用户 ID:321",
48
+ );
49
+ await client.shouldReply(
50
+ 'inspect <sharp id="654"/>',
51
+ "频道 ID:654",
52
+ );
53
+ await client.shouldReply(
54
+ "inspect foobar",
55
+ "参数无法解析。",
56
+ );
40
57
 
41
58
  await client.shouldReply(
42
59
  '<quote id="114514"/> inspect foobar',
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2019-present Shigma and Koishijs contributors.
3
+ // Copyright (c) 2026-present Koishi-CE contributors.
4
+
1
5
  /**
2
6
  * 消息检查插件(inspect)。
3
7
  *