koishi-plugin-onebot-info-image 0.2.0-alpha.9 → 0.4.0-beta.3
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/dist/index.js +1 -0
- package/dist/style.css +1 -0
- package/docs/napcat_al_flat.png +0 -0
- package/docs/napcat_aui_flat.png +0 -0
- package/lib/commandAdminList.d.ts +3 -0
- package/lib/commandGroupEssence.d.ts +38 -0
- package/lib/commandGroupEssenceDetail.d.ts +12 -0
- package/lib/commandGroupNotice.d.ts +45 -0
- package/lib/commandGroupNoticeDetail.d.ts +12 -0
- package/lib/commandInspectStyle.d.ts +3 -0
- package/lib/commandUserInfo.d.ts +3 -0
- package/lib/data_server.d.ts +37 -0
- package/lib/index.d.ts +17 -3
- package/lib/index.js +4417 -473
- package/lib/renderGroupEssence.d.ts +15 -0
- package/lib/renderGroupEssenceDetail.d.ts +8 -0
- package/lib/renderGroupNotice.d.ts +7 -0
- package/lib/renderGroupNoticeDetail.d.ts +8 -0
- package/lib/renderUserInfo.d.ts +4 -1
- package/lib/type.d.ts +4 -0
- package/package.json +8 -1
- package/readme.md +26 -8
- package/lib/renderAdminList.d.ts +0 -3
- package/lib/utils.d.ts +0 -27
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import { type ImageStyle, ImageType } from './type';
|
|
3
|
+
import { PaginatedEssenceResult } from './commandGroupEssence';
|
|
4
|
+
interface EssenceContextInfo {
|
|
5
|
+
groupId: number;
|
|
6
|
+
groupName: string;
|
|
7
|
+
memberCount: number;
|
|
8
|
+
maxMemberCount: number;
|
|
9
|
+
groupAvatarUrl: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 渲染群精华消息列表为图片
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderGroupEssence(ctx: Context, result: PaginatedEssenceResult, contextInfo: EssenceContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import { type ImageStyle, ImageType } from './type';
|
|
3
|
+
import { GroupEssenceMessageRaw } from './commandGroupEssence';
|
|
4
|
+
import { EssenceDetailContextInfo } from './commandGroupEssenceDetail';
|
|
5
|
+
/**
|
|
6
|
+
* 渲染群精华消息详情为图片
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderGroupEssenceDetail(ctx: Context, record: GroupEssenceMessageRaw, contextInfo: EssenceDetailContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import { type ImageStyle, ImageType } from './type';
|
|
3
|
+
import { PaginatedNoticeResult, NoticeContextInfo } from './commandGroupNotice';
|
|
4
|
+
/**
|
|
5
|
+
* 渲染群公告列表图片
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderGroupNotice(ctx: Context, result: PaginatedNoticeResult, contextInfo: NoticeContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Context } from 'koishi';
|
|
2
|
+
import { type ImageStyle, ImageType } from './type';
|
|
3
|
+
import { GroupNoticeMessageRaw } from './commandGroupNotice';
|
|
4
|
+
import { NoticeDetailContextInfo } from './commandGroupNoticeDetail';
|
|
5
|
+
/**
|
|
6
|
+
* 渲染群公告详情图片
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderGroupNoticeDetail(ctx: Context, record: GroupNoticeMessageRaw, contextInfo: NoticeDetailContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
package/lib/renderUserInfo.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Context } from 'koishi';
|
|
2
2
|
import { type ImageStyle, ImageType, UnifiedUserInfo, UnifiedContextInfo } from './type';
|
|
3
|
+
export declare const getSourceHanSerifSCStyleUserInfoHtmlStr: (userInfo: any, contextInfo: any, avatarBase64: any, groupAvatarBase64: any, fontBase64: any, enableDarkMode: any, hidePhoneNumber?: boolean) => Promise<string>;
|
|
4
|
+
export declare const getFlatMinimalUserInfoHtmlStr: (userInfo: any, contextInfo: any, avatarBase64: any, groupAvatarBase64: any, fontBase64: any, enableDarkMode: any, hidePhoneNumber?: boolean) => Promise<string>;
|
|
5
|
+
export declare const getLXGWWenKaiUserInfoHtmlStr: (userInfo: any, contextInfo: any, avatarBase64: any, groupAvatarBase64: any, fontBase64: any, enableDarkMode: any, hidePhoneNumber?: boolean) => Promise<string>;
|
|
3
6
|
/**
|
|
4
7
|
* 渲染用户信息为图片并返回 base64 编码。
|
|
5
8
|
* @param ctx Koishi Context 实例
|
|
@@ -11,4 +14,4 @@ import { type ImageStyle, ImageType, UnifiedUserInfo, UnifiedContextInfo } from
|
|
|
11
14
|
* @param screenshotQuality 截图质量
|
|
12
15
|
* @returns Promise<string> 图片的 base64 编码
|
|
13
16
|
*/
|
|
14
|
-
export declare function renderUserInfo(ctx: Context, userInfo: UnifiedUserInfo, contextInfo: UnifiedContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
|
17
|
+
export declare function renderUserInfo(ctx: Context, userInfo: UnifiedUserInfo, contextInfo: UnifiedContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number, hidePhoneNumber?: boolean): Promise<string>;
|
package/lib/type.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export declare const IMAGE_STYLES: {
|
|
2
2
|
readonly SOURCE_HAN_SERIF_SC: "思源宋体SourceHanSerifSC";
|
|
3
3
|
readonly LXGW_WENKAI: "落霞孤鹜文楷LXGWWenKai";
|
|
4
|
+
readonly FLAT_MINIMAL: "扁平化简约FlatMinimal";
|
|
4
5
|
};
|
|
5
6
|
export type ImageStyle = typeof IMAGE_STYLES[keyof typeof IMAGE_STYLES];
|
|
7
|
+
export type ImageStyleKey = keyof typeof IMAGE_STYLES;
|
|
8
|
+
export declare const IMAGE_STYLE_KEY_ARR: ImageStyleKey[];
|
|
6
9
|
export declare const FONT_FILES: {
|
|
7
10
|
readonly 思源宋体SourceHanSerifSC: "SourceHanSerifSC-Medium.otf";
|
|
8
11
|
readonly 落霞孤鹜文楷LXGWWenKai: "LXGWWenKaiMono-Regular.ttf";
|
|
12
|
+
readonly 扁平化简约FlatMinimal: "LXGWWenKaiMono-Regular.ttf";
|
|
9
13
|
};
|
|
10
14
|
export declare const IMAGE_TYPES: {
|
|
11
15
|
readonly PNG: "png";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-onebot-info-image",
|
|
3
3
|
"description": "用onebot api获取用户详细信息/群管理员列表信息,可以发纯文本/合并转发/渲染图片。 现在只做了lagrange和napcat的适配",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0-beta.3+20251230",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
"onebot"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
+
"@koishijs/plugin-console": "^5.30.0",
|
|
25
26
|
"koishi": "^4.18.7"
|
|
26
27
|
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@koishijs/client": "^5.30.10"
|
|
30
|
+
},
|
|
27
31
|
"koishi": {
|
|
28
32
|
"description": {
|
|
29
33
|
"en": "Fetch detailed user info / group admin list using OneBot API, and send plain text / merged forward messages / rendered images.",
|
|
@@ -33,6 +37,9 @@
|
|
|
33
37
|
"required": [
|
|
34
38
|
"puppeteer",
|
|
35
39
|
"http"
|
|
40
|
+
],
|
|
41
|
+
"optional": [
|
|
42
|
+
"console"
|
|
36
43
|
]
|
|
37
44
|
}
|
|
38
45
|
}
|
package/readme.md
CHANGED
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
# koishi-plugin-onebot-info-image
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/koishi-plugin-onebot-info-image)
|
|
4
|
+
[](https://www.npmjs.com/package/koishi-plugin-onebot-info-image)
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
获取成员信息/管理员列表,发送文字/图片/合并转发消息,仅支持onebot
|
|
6
8
|
|
|
7
|
-
推荐使用Napcat
|
|
9
|
+
推荐使用Napcat
|
|
10
|
+
|
|
11
|
+
### 更新日志
|
|
12
|
+
- **0.3.1-beta.1+20251219**
|
|
13
|
+
- 微调flat模板 aui的样式捏
|
|
14
|
+
- **0.3.0-beta.1+20251219**
|
|
15
|
+
- 增加配置页面webui里面嵌入的html预览捏
|
|
16
|
+
- **0.2.3-beta.1+20251218**
|
|
17
|
+
- 手机号可以强制隐藏捏
|
|
18
|
+
- **0.2.2-beta.1+20251218**
|
|
19
|
+
- 新增:aui指令允许使用qq号进行查询
|
|
20
|
+
- **前面的版本号**
|
|
21
|
+
- 忘了。反正你看到的features都是前面更新的
|
|
8
22
|
|
|
9
23
|
#### Napcat平台渲染效果:
|
|
10
24
|
##### 用户信息:
|
|
11
|
-

|
|
12
|
-

|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
13
28
|
##### 群管理列表:
|
|
14
|
-

|
|
15
|
-

|
|
29
|
+

|
|
30
|
+

|
|
31
|
+

|
|
16
32
|
|
|
17
33
|
## dev
|
|
18
34
|
### 查看git大文件
|
|
19
35
|
```shell
|
|
20
36
|
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | Where-Object { $_ -match '^blob' } | ForEach-Object { $parts = $_ -split ' ', 4; [PSCustomObject]@{ Size = [int]$parts[2]; Name = $parts[3] } } | Sort-Object Size -Descending | Select-Object -First 20
|
|
37
|
+
|
|
38
|
+
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | Where-Object { $_ -match '^blob' } | ForEach-Object { $parts = $_ -split ' ', 4; [PSCustomObject]@{ Size = [int]$parts[2]; File = $parts[3] } } | Sort-Object Size -Descending | Select-Object -First 20 | ForEach-Object { "{0,10} KB {1}" -f ([math]::Round($_.Size/1KB, 2)), $_.File }
|
|
21
39
|
```
|
|
22
40
|
|
|
23
|
-
### 发布到
|
|
41
|
+
### 发布到git workflow
|
|
24
42
|
#### 开发环境:
|
|
25
43
|
```shell
|
|
26
44
|
cd G:\GGames\Minecraft\shuyeyun\qq-bot\koishi-dev\koishi-dev-3\external\onebot-info-image
|
|
@@ -39,7 +57,7 @@ yarn && yarn build
|
|
|
39
57
|
yarn
|
|
40
58
|
```
|
|
41
59
|
|
|
42
|
-
|
|
60
|
+
### 发布到npm workflow
|
|
43
61
|
```shell
|
|
44
62
|
# ensure plugin dir name is *onebot-info-image*, without koishi-plugin prefix then:
|
|
45
63
|
cd G:\GGames\Minecraft\shuyeyun\qq-bot\koishi-dev\koishi-dev-3
|
|
@@ -53,7 +71,7 @@ Invoke-WebRequest -Uri "https://www.google.com" -Method Head -UseBasicParsing
|
|
|
53
71
|
npm login --registry https://registry.npmjs.org
|
|
54
72
|
# login npm in browser
|
|
55
73
|
npm run pub onebot-info-image -- --registry https://registry.npmjs.org
|
|
56
|
-
npm dist-tag add koishi-plugin-onebot-info-image@0.
|
|
74
|
+
npm dist-tag add koishi-plugin-onebot-info-image@0.4.0-beta.3+20251230 latest --registry https://registry.npmjs.org
|
|
57
75
|
|
|
58
76
|
npm view koishi-plugin-onebot-info-image
|
|
59
77
|
npm-stat.com
|
package/lib/renderAdminList.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Context } from 'koishi';
|
|
2
|
-
import { type ImageStyle, ImageType, UnifiedAdminInfo, UnifiedContextInfo } from './type';
|
|
3
|
-
export declare function renderAdminList(ctx: Context, admins: UnifiedAdminInfo[], contextInfo: UnifiedContextInfo, imageStyle: ImageStyle, enableDarkMode: boolean, imageType: ImageType, screenshotQuality: number): Promise<string>;
|
package/lib/utils.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Context } from 'koishi';
|
|
2
|
-
import { type ImageStyle } from './type';
|
|
3
|
-
/**
|
|
4
|
-
* 生成当前时间戳字符串
|
|
5
|
-
* @returns 格式为 YYYY/MM/DD HH:MM:SS 的时间戳字符串
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateTimestamp(): string;
|
|
8
|
-
/**
|
|
9
|
-
* 获取群头像的 Base64 编码
|
|
10
|
-
* @param ctx Koishi Context 实例
|
|
11
|
-
* @param groupId 群号
|
|
12
|
-
* @returns Promise<string> 群头像的 base64 编码
|
|
13
|
-
*/
|
|
14
|
-
export declare function getGroupAvatarBase64(ctx: Context, groupId: string): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* 获取字体文件的 Base64 编码
|
|
17
|
-
* @param ctx Koishi Context 实例
|
|
18
|
-
* @param imageStyle 图片样式
|
|
19
|
-
* @returns Promise<string> 字体文件的 base64 编码
|
|
20
|
-
*/
|
|
21
|
-
export declare function getFontBase64(ctx: Context, imageStyle: ImageStyle): Promise<string>;
|
|
22
|
-
/**
|
|
23
|
-
* 验证并下载字体文件
|
|
24
|
-
* @param ctx Koishi Context 实例
|
|
25
|
-
* @returns Promise<void>
|
|
26
|
-
*/
|
|
27
|
-
export declare function validateFonts(ctx: Context): Promise<void>;
|