koishi-plugin-sy-bot 0.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.
@@ -0,0 +1 @@
1
+ export declare function registerCommand(ctx: any, config: any): void;
@@ -0,0 +1,2 @@
1
+ import { Config } from "../index";
2
+ export declare function registerAsk(ctx: any, config: Config): void;
@@ -0,0 +1 @@
1
+ export declare function registerBible(ctx: any, config: any): void;
@@ -0,0 +1 @@
1
+ export declare function registerCountdown(ctx: any, config: any): void;
@@ -0,0 +1 @@
1
+ export declare function registerResource(ctx: any, config: any): void;
@@ -0,0 +1 @@
1
+ export declare function registerTest_md(ctx: any, config: any): void;
@@ -0,0 +1 @@
1
+ export declare function registerTest(ctx: any, config: any): void;
@@ -0,0 +1 @@
1
+ export declare function registerTip(ctx: any, config: any): void;
package/lib/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { Context, Schema } from "koishi";
2
+ export declare const name = "sy-bot";
3
+ export declare const inject: {
4
+ required: string[];
5
+ };
6
+ export interface Config {
7
+ api: string;
8
+ model: string;
9
+ prompt: string;
10
+ }
11
+ export declare const Config: Schema<Config>;
12
+ export declare function apply(ctx: Context, config: Config): void;
package/lib/index.js ADDED
@@ -0,0 +1,543 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name2 in all)
10
+ __defProp(target, name2, { get: all[name2], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ Config: () => Config,
34
+ apply: () => apply,
35
+ inject: () => inject,
36
+ name: () => name
37
+ });
38
+ module.exports = __toCommonJS(src_exports);
39
+ var import_koishi3 = require("koishi");
40
+
41
+ // src/utils/utils.tsx
42
+ var import_axios = __toESM(require("axios"));
43
+ var import_koishi = require("koishi");
44
+
45
+ // src/values.ts
46
+ var emojis = {
47
+ ok_no_hair: "428",
48
+ press_red_light: "424",
49
+ he_cai: "144"
50
+ };
51
+
52
+ // src/utils/markdownToImage.ts
53
+ var import_markdown_it = __toESM(require("markdown-it"));
54
+ var import_markdown_it_katex = __toESM(require("@vscode/markdown-it-katex"));
55
+ var import_highlight = __toESM(require("highlight.js"));
56
+ var import_fs = __toESM(require("fs"));
57
+ async function markdownToImage(ctx, markdown) {
58
+ const md = new import_markdown_it.default({
59
+ html: true,
60
+ linkify: true,
61
+ typographer: true,
62
+ highlight(code, lang) {
63
+ if (lang && import_highlight.default.getLanguage(lang)) {
64
+ return `<pre class="hljs"><code>${import_highlight.default.highlight(code, {
65
+ language: lang
66
+ }).value}</code></pre>`;
67
+ }
68
+ return `<pre class="hljs"><code>${md.utils.escapeHtml(code)}</code></pre>`;
69
+ }
70
+ });
71
+ md.use(import_markdown_it_katex.default);
72
+ const htmlContent = md.render(markdown);
73
+ const hljsCss = import_fs.default.readFileSync(
74
+ require.resolve("highlight.js/styles/github-dark.css"),
75
+ "utf8"
76
+ );
77
+ const html = `
78
+ <!DOCTYPE html>
79
+ <html lang="zh-CN">
80
+ <head>
81
+ <meta charset="UTF-8" />
82
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.4/dist/katex.min.css"/>
83
+ <style>
84
+ body {
85
+ margin: 0;
86
+ padding: 32px;
87
+ background: #ffffff;
88
+ font-family:
89
+ -apple-system, BlinkMacSystemFont, "Segoe UI",
90
+ "PingFang SC", "Hiragino Sans GB",
91
+ "Microsoft YaHei", sans-serif;
92
+ }
93
+
94
+ .container {
95
+ max-width: 900px;
96
+ margin: 0 auto;
97
+ line-height: 1.75;
98
+ color: #1f2937;
99
+ font-size: 16px;
100
+ }
101
+
102
+ h1, h2, h3, h4 {
103
+ font-weight: 600;
104
+ margin: 1.2em 0 0.6em;
105
+ }
106
+
107
+ h1 { font-size: 28px; }
108
+ h2 { font-size: 24px; }
109
+ h3 { font-size: 20px; }
110
+
111
+ p {
112
+ margin: 0.6em 0;
113
+ }
114
+
115
+ pre {
116
+ background: #0f172a;
117
+ color: #e5e7eb;
118
+ padding: 16px;
119
+ border-radius: 10px;
120
+ overflow-x: auto;
121
+ font-size: 14px;
122
+ }
123
+
124
+ code {
125
+ font-family: "JetBrains Mono", "Fira Code", monospace;
126
+ }
127
+
128
+ blockquote {
129
+ border-left: 4px solid #3b82f6;
130
+ background: #f1f5f9;
131
+ padding: 12px 16px;
132
+ margin: 16px 0;
133
+ color: #334155;
134
+ border-radius: 6px;
135
+ }
136
+
137
+ table {
138
+ border-collapse: collapse;
139
+ margin: 16px 0;
140
+ }
141
+
142
+ th, td {
143
+ border: 1px solid #e5e7eb;
144
+ padding: 8px 12px;
145
+ }
146
+
147
+ .katex {
148
+ font-size: 1.05em;
149
+ }
150
+ ${hljsCss}
151
+ </style>
152
+
153
+ <!-- highlight.js 样式(内联版) -->
154
+
155
+ </head>
156
+ <body>
157
+ <div class="container">
158
+ ${htmlContent}
159
+ </div>
160
+ </body>
161
+ </html>
162
+ `;
163
+ const page = await ctx.puppeteer.page();
164
+ await page.setViewport({
165
+ width: 1e3,
166
+ height: 10,
167
+ deviceScaleFactor: 2
168
+ });
169
+ await page.setContent(html, {
170
+ waitUntil: "networkidle0"
171
+ });
172
+ const body = await page.$("body");
173
+ const box = await body.boundingBox();
174
+ const buffer = await page.screenshot({
175
+ type: "png",
176
+ clip: {
177
+ x: 0,
178
+ y: 0,
179
+ width: Math.ceil(box.width),
180
+ height: Math.ceil(box.height)
181
+ }
182
+ });
183
+ await page.close();
184
+ return buffer;
185
+ }
186
+ __name(markdownToImage, "markdownToImage");
187
+
188
+ // src/utils/utils.tsx
189
+ var import_jsx_runtime = require("@satorijs/element/jsx-runtime");
190
+ function getKaoyanCountdownText(targetTime) {
191
+ const target = new Date(targetTime).getTime();
192
+ const now = Date.now();
193
+ const diff = target - now;
194
+ if (diff <= 0) {
195
+ return "📚 27考研已开始,祝你成功上岸!";
196
+ }
197
+ const days = Math.floor(diff / (1e3 * 60 * 60 * 24));
198
+ const hours = Math.floor(diff / (1e3 * 60 * 60) % 24);
199
+ const minutes = Math.floor(diff / (1e3 * 60) % 60);
200
+ const seconds = Math.floor(diff / 1e3 % 60);
201
+ return `📖 距离27考研还有:${days}天 ${hours}小时 ${minutes}分 ${seconds}秒`;
202
+ }
203
+ __name(getKaoyanCountdownText, "getKaoyanCountdownText");
204
+ async function sendGroupMessageReaction(session, face_id, ifSet = true) {
205
+ await session.bot.internal.sendGroupMessageReaction(
206
+ Number(session.guildId),
207
+ // 群聊号
208
+ Number(session.event.message.id),
209
+ // 消息id
210
+ // "424", // 红灯
211
+ face_id,
212
+ // 累的一批
213
+ ifSet
214
+ );
215
+ }
216
+ __name(sendGroupMessageReaction, "sendGroupMessageReaction");
217
+ async function getAiChatResult({ config, user_query }) {
218
+ try {
219
+ const { model: MODEL, api: API_KEY, prompt: system_prompt } = config;
220
+ const { data } = await import_axios.default.post(
221
+ `https://api.qingyuntop.top/v1beta/models/${MODEL}?key=${API_KEY}`,
222
+ {
223
+ systemInstruction: {
224
+ parts: [
225
+ {
226
+ text: system_prompt
227
+ }
228
+ ]
229
+ },
230
+ contents: [
231
+ {
232
+ role: "user",
233
+ parts: [
234
+ {
235
+ text: user_query
236
+ }
237
+ ]
238
+ }
239
+ ],
240
+ generationConfig: {
241
+ temperature: 1,
242
+ topP: 1,
243
+ thinkingConfig: {
244
+ includeThoughts: true,
245
+ thinkingBudget: 26240
246
+ }
247
+ }
248
+ }
249
+ );
250
+ const { content } = data.candidates[0];
251
+ const result = content.parts[1].text;
252
+ return result;
253
+ } catch (error) {
254
+ console.error("<getAiChatResult()<function> 调用报错!\n", error);
255
+ }
256
+ }
257
+ __name(getAiChatResult, "getAiChatResult");
258
+ async function imageUrlToBase64(ctx, url) {
259
+ const arrayBuffer = await ctx.http.get(url, {
260
+ responseType: "arraybuffer"
261
+ });
262
+ const buffer = Buffer.from(arrayBuffer);
263
+ return buffer.toString("base64");
264
+ }
265
+ __name(imageUrlToBase64, "imageUrlToBase64");
266
+ async function getAiImgUnderstandMultiple({
267
+ ctx,
268
+ config,
269
+ url_list,
270
+ query
271
+ }) {
272
+ try {
273
+ const { model: MODEL, api: API_KEY } = config;
274
+ let base64_list = [];
275
+ for (const url of url_list) {
276
+ const base64 = await imageUrlToBase64(ctx, url);
277
+ base64_list = [...base64_list, base64];
278
+ }
279
+ const partial_imgs = base64_list.map((base64) => ({
280
+ inline_data: {
281
+ mime_type: "image/png",
282
+ data: base64
283
+ }
284
+ }));
285
+ const BODY = {
286
+ contents: [
287
+ {
288
+ role: "user",
289
+ parts: [
290
+ ...partial_imgs,
291
+ {
292
+ text: query
293
+ }
294
+ ]
295
+ }
296
+ ]
297
+ };
298
+ const { data } = await import_axios.default.post(
299
+ `https://api.qingyuntop.top/v1beta/models/${MODEL}?key=${API_KEY}`,
300
+ BODY
301
+ );
302
+ const { text } = data.candidates[0].content.parts[1];
303
+ return text;
304
+ } catch (error) {
305
+ console.error("<getAiChatResult()<function> 调用报错!\n", error);
306
+ }
307
+ }
308
+ __name(getAiImgUnderstandMultiple, "getAiImgUnderstandMultiple");
309
+ async function textToImage(ctx, text) {
310
+ const imageBuffer = await markdownToImage(ctx, text);
311
+ return import_koishi.h.image(imageBuffer, "image/png");
312
+ }
313
+ __name(textToImage, "textToImage");
314
+ function getElementsText(elements) {
315
+ if (!elements) return "";
316
+ return elements.filter((e) => e.type == "text").map((e) => e.attrs.content).join("");
317
+ }
318
+ __name(getElementsText, "getElementsText");
319
+ function getElementsImages(elements) {
320
+ if (!elements) return [];
321
+ return elements.filter((e) => e.type == "img").map((e) => e.attrs.src);
322
+ }
323
+ __name(getElementsImages, "getElementsImages");
324
+ async function sendOnlyText({ session, ctx, config, query }) {
325
+ const quote = session?.event?.message?.quote?.content;
326
+ const question = quote ? query + quote : query;
327
+ const raw_answer = await getAiChatResult({
328
+ config,
329
+ user_query: question
330
+ });
331
+ console.log("AI的回复:", raw_answer);
332
+ const h_ans_img = await textToImage(ctx, raw_answer);
333
+ session.send(
334
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("quote", { id: session.event.message.id }) + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("at", { id: session.event.user.id }) + h_ans_img + "\n"
335
+ );
336
+ }
337
+ __name(sendOnlyText, "sendOnlyText");
338
+ async function startEmoji(session) {
339
+ await sendGroupMessageReaction(session, emojis["press_red_light"]);
340
+ }
341
+ __name(startEmoji, "startEmoji");
342
+ async function finishEmoji(session) {
343
+ await sendGroupMessageReaction(session, emojis["he_cai"]);
344
+ }
345
+ __name(finishEmoji, "finishEmoji");
346
+ async function sendNotOnlyText({
347
+ ctx,
348
+ config,
349
+ session,
350
+ url_list,
351
+ query
352
+ }) {
353
+ const raw_answer = await getAiImgUnderstandMultiple({
354
+ ctx,
355
+ config,
356
+ url_list,
357
+ query
358
+ });
359
+ console.log("AI的回答:", raw_answer);
360
+ const h_ans_img = await textToImage(ctx, raw_answer);
361
+ session.send(
362
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("quote", { id: session.event.message.id }) + /* @__PURE__ */ (0, import_jsx_runtime.jsx)("at", { id: session.event.user.id }) + h_ans_img + "\n"
363
+ );
364
+ }
365
+ __name(sendNotOnlyText, "sendNotOnlyText");
366
+
367
+ // src/commands/ask.tsx
368
+ function registerAsk(ctx, config) {
369
+ ctx.command("ask", "哈基米?哈基米~").action(async ({ session }) => {
370
+ try {
371
+ const messageElements = session.event.message.elements;
372
+ const quoteElements = session.event.message.quote?.elements;
373
+ const quoteRealText = getElementsText(quoteElements);
374
+ const messageRealText = getElementsText(messageElements);
375
+ const quoteImages = getElementsImages(quoteElements);
376
+ const messageImages = getElementsImages(messageElements);
377
+ const finalText = quoteRealText + messageRealText;
378
+ const finalImages = [...quoteImages, ...messageImages];
379
+ console.log("用户输入的图像:", finalImages);
380
+ console.log("用户输入的文字:", finalText);
381
+ await startEmoji(session);
382
+ if (finalImages.length > 0) {
383
+ await sendNotOnlyText({
384
+ ctx,
385
+ session,
386
+ config,
387
+ url_list: finalImages,
388
+ query: finalText
389
+ });
390
+ } else {
391
+ await sendOnlyText({ session, ctx, config, query: finalText });
392
+ }
393
+ await finishEmoji(session);
394
+ } catch (err) {
395
+ console.error(err);
396
+ return "调用ask发生错误:" + (err instanceof Error ? err.message : String(err));
397
+ }
398
+ });
399
+ }
400
+ __name(registerAsk, "registerAsk");
401
+
402
+ // src/commands/bible.ts
403
+ function registerBible(ctx, config) {
404
+ ctx.command("bible [index:number]", "圣经").action(async ({ session }, index) => {
405
+ const bibles = await ctx.database.get("bibles");
406
+ if (!index) {
407
+ return "======== 圣经列表 ========\n" + bibles.map((bible) => `${bible.id} - 《${bible.title}》`).join("\n");
408
+ } else {
409
+ return bibles[index - 1] ? bibles[index - 1].content : "没有这个哦,喵~";
410
+ }
411
+ });
412
+ }
413
+ __name(registerBible, "registerBible");
414
+
415
+ // src/commands/countdown.ts
416
+ function registerCountdown(ctx, config) {
417
+ ctx.command("countdown", "27考研倒计时").action(() => {
418
+ return getKaoyanCountdownText("2026-12-21T00:00:00");
419
+ });
420
+ }
421
+ __name(registerCountdown, "registerCountdown");
422
+
423
+ // src/commands/resource.ts
424
+ function registerResource(ctx, config) {
425
+ ctx.command("resource [index:number]", "获取26,27做题本/习题册/讲义pdf").action(async (_, index) => {
426
+ const resources = await ctx.database.get("resources");
427
+ if (!index) {
428
+ const top = "-------- 资源合集 \n----------------\n";
429
+ return top + resources.map((res) => `${res.id} 《${res.title}》`).join(" \n");
430
+ } else {
431
+ return resources[index - 1] ? resources[index - 1].content : "没有这个哦,喵";
432
+ }
433
+ });
434
+ }
435
+ __name(registerResource, "registerResource");
436
+
437
+ // src/commands/test-md.ts
438
+ var import_koishi2 = require("koishi");
439
+ function registerTest_md(ctx, config) {
440
+ ctx.command("test-md", "测试 Markdown 图片转换").action(async ({ session }) => {
441
+ const markdown = `
442
+ # Hello, Koishi
443
+
444
+ This is a test.
445
+
446
+ - LaTeX: $E=mc^2$
447
+ - Code:
448
+ \`\`\`typescript
449
+ console.log('Hello, world!')
450
+ \`\`\`
451
+ - Mermaid:
452
+ \`\`\`mermaid
453
+ graph TD;
454
+ A-->B;
455
+ A-->C;
456
+ B-->D;
457
+ C-->D;
458
+ \`\`\`
459
+ `;
460
+ const imageBuffer = await markdownToImage(ctx, markdown);
461
+ return import_koishi2.h.image(imageBuffer, "image/png");
462
+ });
463
+ }
464
+ __name(registerTest_md, "registerTest_md");
465
+
466
+ // src/commands/tip.ts
467
+ function registerTip(ctx, config) {
468
+ ctx.command("tip [index:number]", "经验贴合集").action(async (_, index) => {
469
+ const tips = await ctx.database.get("tips");
470
+ if (!index) {
471
+ const top = "-------- 经验贴合集 \n----------------\n";
472
+ return top + tips.map((tip) => `${tip.id} 《${tip.title}》`).join(" \n");
473
+ } else {
474
+ return tips[index - 1] ? tips[index - 1].url : "没有这个哦,喵";
475
+ }
476
+ });
477
+ }
478
+ __name(registerTip, "registerTip");
479
+
480
+ // src/commands/test.tsx
481
+ function registerTest(ctx, config) {
482
+ ctx.command("test", "测试引用命令").action(async ({ session }, index) => {
483
+ });
484
+ }
485
+ __name(registerTest, "registerTest");
486
+
487
+ // src/command.ts
488
+ function registerCommand(ctx, config) {
489
+ registerAsk(ctx, config);
490
+ registerBible(ctx, config);
491
+ registerCountdown(ctx, config);
492
+ registerResource(ctx, config);
493
+ registerTip(ctx, config);
494
+ registerTest(ctx, config);
495
+ registerTest_md(ctx, config);
496
+ }
497
+ __name(registerCommand, "registerCommand");
498
+
499
+ // src/tables.ts
500
+ function registerTables(ctx) {
501
+ ctx.model.extend("tips", {
502
+ // 各字段的类型声明
503
+ id: "unsigned",
504
+ title: "string",
505
+ url: "string"
506
+ });
507
+ ctx.model.extend("bibles", {
508
+ // 各字段的类型声明
509
+ id: "unsigned",
510
+ title: "string",
511
+ content: "string"
512
+ });
513
+ ctx.model.extend("resources", {
514
+ // 各字段的类型声明
515
+ id: "unsigned",
516
+ title: "string",
517
+ content: "string"
518
+ });
519
+ }
520
+ __name(registerTables, "registerTables");
521
+
522
+ // src/index.ts
523
+ var name = "sy-bot";
524
+ var inject = {
525
+ required: ["database", "puppeteer"]
526
+ };
527
+ var Config = import_koishi3.Schema.object({
528
+ api: import_koishi3.Schema.string().required(),
529
+ model: import_koishi3.Schema.string().required(),
530
+ prompt: import_koishi3.Schema.string().required()
531
+ });
532
+ function apply(ctx, config) {
533
+ registerCommand(ctx, config);
534
+ registerTables(ctx);
535
+ }
536
+ __name(apply, "apply");
537
+ // Annotate the CommonJS export names for ESM import in node:
538
+ 0 && (module.exports = {
539
+ Config,
540
+ apply,
541
+ inject,
542
+ name
543
+ });
@@ -0,0 +1,23 @@
1
+ declare module "koishi" {
2
+ interface Tables {
3
+ tips: Tips;
4
+ bibles: Bibles;
5
+ resource: Resource;
6
+ }
7
+ }
8
+ export interface Tips {
9
+ id: number;
10
+ title: string;
11
+ url: Date;
12
+ }
13
+ export interface Bibles {
14
+ id: number;
15
+ title: string;
16
+ content: string;
17
+ }
18
+ export interface Resource {
19
+ id: number;
20
+ title: string;
21
+ content: string;
22
+ }
23
+ export declare function registerTables(ctx: any): void;
@@ -0,0 +1,11 @@
1
+ import type { Context } from "koishi";
2
+ export declare const inject: {
3
+ required: string[];
4
+ };
5
+ /**
6
+ * Markdown 转图片
7
+ * @param ctx Koishi Context(需要 puppeteer)
8
+ * @param markdown Markdown 字符串
9
+ * @returns PNG Buffer
10
+ */
11
+ export declare function markdownToImage(ctx: Context, markdown: string): Promise<Buffer>;
@@ -0,0 +1,46 @@
1
+ import { Context, h, Session } from "koishi";
2
+ /**
3
+ * 获取倒计时提示文本
4
+ * @param {Date | string | number} targetTime 目标时间
5
+ * @returns {string} 倒计时提示文本
6
+ */
7
+ export declare function getKaoyanCountdownText(targetTime: any): string;
8
+ export declare function getPrompt(): void;
9
+ export declare function sendGroupMessageReaction(session: any, face_id: any, ifSet?: boolean): Promise<void>;
10
+ export declare function getAiChatResult({ config, user_query }: {
11
+ config: any;
12
+ user_query: any;
13
+ }): Promise<any>;
14
+ export declare function imageUrlToBase64(ctx: Context, url: string): Promise<string>;
15
+ export declare function getAiImgUnderstand({ ctx, config, url, query }: {
16
+ ctx: any;
17
+ config: any;
18
+ url: any;
19
+ query: any;
20
+ }): Promise<any>;
21
+ export declare function getAiImgUnderstandMultiple({ ctx, config, url_list, query, }: {
22
+ ctx: any;
23
+ config: any;
24
+ url_list: any;
25
+ query: any;
26
+ }): Promise<any>;
27
+ export declare function textToImage(ctx: any, text: any): Promise<h>;
28
+ export declare function getElementsText(elements: any): any;
29
+ export declare function getElementsImages(elements: any): any;
30
+ export declare function sendOnlyText({ session, ctx, config, query }: {
31
+ session: any;
32
+ ctx: any;
33
+ config: any;
34
+ query: any;
35
+ }): Promise<void>;
36
+ export declare function sendEmpty(query: any): boolean;
37
+ export declare function startEmoji(session: Session): Promise<void>;
38
+ export declare function finishEmoji(session: Session): Promise<void>;
39
+ export declare function sendNotOnlyText({ ctx, config, session, url_list, query, }: {
40
+ ctx: any;
41
+ config: any;
42
+ session: any;
43
+ url_list: any;
44
+ query: any;
45
+ }): Promise<void>;
46
+ export declare function cutBeginAsk(str: any): any;
package/lib/utils.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { Context, h, Session } from "koishi";
2
+ /**
3
+ * 获取倒计时提示文本
4
+ * @param {Date | string | number} targetTime 目标时间
5
+ * @returns {string} 倒计时提示文本
6
+ */
7
+ export declare function getKaoyanCountdownText(targetTime: any): string;
8
+ export declare function getPrompt(): void;
9
+ export declare function sendGroupMessageReaction(session: any, face_id: any, ifSet?: boolean): Promise<void>;
10
+ export declare function getAiChatResult({ config, user_query }: {
11
+ config: any;
12
+ user_query: any;
13
+ }): Promise<any>;
14
+ export declare function imageUrlToBase64(ctx: Context, url: string): Promise<string>;
15
+ export declare function getAiImgUnderstand({ ctx, config, url, query }: {
16
+ ctx: any;
17
+ config: any;
18
+ url: any;
19
+ query: any;
20
+ }): Promise<any>;
21
+ export declare function getAiImgUnderstandMultiple({ ctx, config, url_list, query, }: {
22
+ ctx: any;
23
+ config: any;
24
+ url_list: any;
25
+ query: any;
26
+ }): Promise<any>;
27
+ export declare function textToImage(ctx: any, text: any): Promise<h>;
28
+ export declare function getElementsText(elements: any): any;
29
+ export declare function getElementsImages(elements: any): any;
30
+ export declare function sendOnlyText({ session, ctx, config, query }: {
31
+ session: any;
32
+ ctx: any;
33
+ config: any;
34
+ query: any;
35
+ }): Promise<void>;
36
+ export declare function sendEmpty(query: any): boolean;
37
+ export declare function startEmoji(session: Session): Promise<void>;
38
+ export declare function finishEmoji(session: Session): Promise<void>;
39
+ export declare function sendNotOnlyText({ ctx, config, session, url_list, query, }: {
40
+ ctx: any;
41
+ config: any;
42
+ session: any;
43
+ url_list: any;
44
+ query: any;
45
+ }): Promise<void>;
46
+ export declare function cutBeginAsk(str: any): any;
@@ -0,0 +1,5 @@
1
+ export declare const emojis: {
2
+ ok_no_hair: string;
3
+ press_red_light: string;
4
+ he_cai: string;
5
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "koishi-plugin-sy-bot",
3
+ "description": "个人qq群Bot - 风纪委员",
4
+ "version": "0.0.1",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "dist"
10
+ ],
11
+ "license": "MIT",
12
+ "scripts": {},
13
+ "keywords": [
14
+ "chatbot",
15
+ "koishi",
16
+ "plugin"
17
+ ],
18
+ "peerDependencies": {
19
+ "koishi": "^4.18.7"
20
+ },
21
+ "dependencies": {
22
+ "@satorijs/element": "^3.1.8",
23
+ "@vscode/markdown-it-katex": "^1.1.2",
24
+ "axios": "^1.13.2",
25
+ "highlight": "^0.2.4",
26
+ "highlight.js": "^11.11.1",
27
+ "markdown-it": "^14.1.0"
28
+ }
29
+ }
package/readme.md ADDED
@@ -0,0 +1,5 @@
1
+ # koishi-plugin-sy-bot
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-sy-bot?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-sy-bot)
4
+
5
+ test