mioku-plugin-meme 3.0.0 → 3.0.1
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/package.json +1 -1
- package/shared.ts +3 -3
- package/skills/meme.ts +4 -4
- package/types.ts +1 -1
package/package.json
CHANGED
package/shared.ts
CHANGED
|
@@ -914,8 +914,8 @@ export class MemePluginRuntime {
|
|
|
914
914
|
}
|
|
915
915
|
|
|
916
916
|
if (sourceType === "message_image") {
|
|
917
|
-
const messageId =
|
|
918
|
-
if (!
|
|
917
|
+
const messageId = String(source?.messageId ?? "").trim();
|
|
918
|
+
if (!messageId) {
|
|
919
919
|
return [];
|
|
920
920
|
}
|
|
921
921
|
const imageUrl = await this.getImageUrlByMessageId(ctx, event, messageId);
|
|
@@ -959,7 +959,7 @@ export class MemePluginRuntime {
|
|
|
959
959
|
private async getImageUrlByMessageId(
|
|
960
960
|
ctx: any,
|
|
961
961
|
event: any,
|
|
962
|
-
messageId: number,
|
|
962
|
+
messageId: string | number,
|
|
963
963
|
): Promise<string | null> {
|
|
964
964
|
try {
|
|
965
965
|
const bot = event?.bot;
|
package/skills/meme.ts
CHANGED
|
@@ -33,8 +33,8 @@ function parseImageSource(args: any): {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (sourceType === "message_image") {
|
|
36
|
-
const messageId =
|
|
37
|
-
if (!
|
|
36
|
+
const messageId = String(args?.message_id ?? "").trim();
|
|
37
|
+
if (!messageId) {
|
|
38
38
|
return {
|
|
39
39
|
ok: false,
|
|
40
40
|
message: "source_type=message_image 时必须提供有效的 message_id。",
|
|
@@ -114,9 +114,9 @@ export function createMemeSkills(runtime: MemePluginRuntime): AISkill[] {
|
|
|
114
114
|
description: "source_type=user_avatar 时必填,头像对应 QQ 号",
|
|
115
115
|
},
|
|
116
116
|
message_id: {
|
|
117
|
-
type: "number",
|
|
117
|
+
type: ["number", "string"],
|
|
118
118
|
description:
|
|
119
|
-
"source_type=message_image 时必填,包含图片的消息 message_id",
|
|
119
|
+
"source_type=message_image 时必填,包含图片的消息 message_id(支持数字或含字母的字符串 id)",
|
|
120
120
|
},
|
|
121
121
|
},
|
|
122
122
|
required: ["keyword", "source_type"],
|
package/types.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type MemeImageSourceType = "auto" | "user_avatar" | "message_image";
|
|
|
43
43
|
export interface MemeImageSourceOptions {
|
|
44
44
|
type?: MemeImageSourceType;
|
|
45
45
|
qq?: number;
|
|
46
|
-
messageId?: number;
|
|
46
|
+
messageId?: number | string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface MemeInfoParams {
|