koishi-plugin-starfx-bot 0.1.0 → 0.1.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.
Binary file
Binary file
package/lib/index.d.ts CHANGED
@@ -9,6 +9,6 @@ export declare const Config: Schema<Config>;
9
9
  export declare const usage = "StarFreedomX\u7684\u81EA\u7528\u63D2\u4EF6 \u653E\u4E86\u4E00\u4E9B\u5C0F\u529F\u80FD";
10
10
  export declare function apply(ctx: Context, cfg: Config): void;
11
11
  export declare function getImageSrc(session: Session, param: string): Promise<string>;
12
- export declare function drawLock(baseImage: string): Promise<h>;
13
- export declare function drawSold(baseImage: string): Promise<h>;
12
+ export declare function drawLock(baseImage: string): Promise<"输入无效。" | h>;
13
+ export declare function drawSold(baseImage: string): Promise<"输入无效。" | h>;
14
14
  export declare function getMemberInfo(member: Universal.GuildMember, id: string): string[];
package/lib/index.js CHANGED
@@ -90,6 +90,13 @@ async function getImageSrc(session, param) {
90
90
  return param.match(/<img[^>]*\s+src="([^"]+)"/i)?.[1] ?? null;
91
91
  } else {
92
92
  console.log("other");
93
+ const index = param.indexOf("<");
94
+ param = param.slice(index);
95
+ if (param?.length) {
96
+ return "";
97
+ } else {
98
+ return getImageSrc(session, param);
99
+ }
93
100
  }
94
101
  if (userid) {
95
102
  const memberList = await getMemberList(session, gid);
@@ -114,6 +121,9 @@ async function getMemberList(session, gid) {
114
121
  }
115
122
  __name(getMemberList, "getMemberList");
116
123
  async function drawLock(baseImage) {
124
+ if (!baseImage) {
125
+ return "输入无效。";
126
+ }
117
127
  const lockUrl = `${baseDir}/data/starfx-bot/assets/lock.png`;
118
128
  const image = await import_jimp.Jimp.read(baseImage);
119
129
  const size1 = image.width > image.height ? image.height : image.width;
@@ -125,6 +135,9 @@ async function drawLock(baseImage) {
125
135
  }
126
136
  __name(drawLock, "drawLock");
127
137
  async function drawSold(baseImage) {
138
+ if (!baseImage) {
139
+ return "输入无效。";
140
+ }
128
141
  const soldUrl = `${baseDir}/data/starfx-bot/assets/sold.png`;
129
142
  const image = await import_jimp.Jimp.read(baseImage);
130
143
  const size1 = image.width > image.height ? image.height : image.width;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "contributors": [
5
5
  "StarFreedomX <starfreedomx@outlook.com>"
6
6
  ],
7
- "version": "0.1.0",
7
+ "version": "0.1.1",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
10
10
  "files": [