@azimiao/koishi-plugin-cafe-bot-exp 0.0.5 → 0.0.8

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,5 @@
1
+ # koishi-plugin-cafe-bot-exp
2
+
3
+ [![npm](https://img.shields.io/npm/v/@azimiao/koishi-plugin-cafe-bot-exp?style=flat-square)](https://www.npmjs.com/package/@azimiao/koishi-plugin-cafe-bot-exp)
4
+
5
+ 基于 QQ 官方机器人的轨迹 Cafe 群 Bot 代码,包含每日抽卡,答题等功能。
@@ -0,0 +1,9 @@
1
+ import { Schema } from "koishi";
2
+ export interface CafeBotCatConfig {
3
+ catName: string;
4
+ }
5
+ export declare const CafeBotCatConfig: Schema<Schemastery.ObjectS<{
6
+ catName: Schema<string, string>;
7
+ }>, Schemastery.ObjectT<{
8
+ catName: Schema<string, string>;
9
+ }>>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 黑猫柯贝
3
+ */
4
+ import { Context, Schema } from 'koishi';
5
+ import { CafeBotCatConfig } from './config';
6
+ export declare const name = "cafe-bot-exp.cat";
7
+ export interface Config extends CafeBotCatConfig {
8
+ }
9
+ export declare const Config: Schema<Config>;
10
+ export declare function apply(ctx: Context): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function DailySeededName(uid: any): string;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * PseudoRandom 伪随机数类
3
+ */
4
+ declare class PseudoRandom {
5
+ private seed;
6
+ private randFunc;
7
+ constructor(seedStr: string);
8
+ next: () => number;
9
+ nextInt: (min: number, max: number) => number;
10
+ }
11
+ export default PseudoRandom;
@@ -0,0 +1 @@
1
+ export declare function At(argv: any, newLine?: boolean): string;
package/lib/config.d.ts CHANGED
@@ -1,23 +1,6 @@
1
1
  import { Schema } from "koishi";
2
- export interface CafeBotDrawConfig {
3
- baseDataUrl: string;
4
- ImageServer: string;
5
- ImageServerAuth: string;
6
- MinCount: number;
7
- MaxCount: number;
8
- Star1Name: string;
9
- Star1Chance: number;
10
- Star2Name: string;
11
- Star2Chance: number;
12
- Star3Name: string;
13
- Star3Chance: number;
14
- Star4Name: string;
15
- Star4Chance: number;
16
- Star5Name: string;
17
- Star5Chance: number;
18
- }
19
- export interface CafeBotQuizConfig {
20
- baseQuizUrl: string;
21
- }
22
- export type Config = CafeBotDrawConfig & CafeBotQuizConfig;
2
+ import { CafeBotDrawConfig } from "./draw/config";
3
+ import { CafeBotQuizConfig } from "./quiz/config";
4
+ import { CafeBotCatConfig } from "./cat/config";
5
+ export type Config = CafeBotDrawConfig & CafeBotQuizConfig & CafeBotCatConfig;
23
6
  export declare const Config: Schema<Config>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 轨迹抽卡配置
3
+ */
4
+ import { Schema } from "koishi";
5
+ export interface CafeBotDrawConfig {
6
+ baseDataUrl: string;
7
+ ImageServer: string;
8
+ ImageServerAuth: string;
9
+ MinCount: number;
10
+ MaxCount: number;
11
+ Star1Name: string;
12
+ Star1Chance: number;
13
+ Star2Name: string;
14
+ Star2Chance: number;
15
+ Star3Name: string;
16
+ Star3Chance: number;
17
+ Star4Name: string;
18
+ Star4Chance: number;
19
+ Star5Name: string;
20
+ Star5Chance: number;
21
+ }
22
+ export declare const CafeBotDrawConfig: Schema<CafeBotDrawConfig>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 轨迹抽卡
3
+ */
4
+ import { Context, Schema } from 'koishi';
5
+ import { CafeBotDrawConfig } from './config';
6
+ export declare const name = "cafe-bot-exp.draw";
7
+ export declare const inject: string[];
8
+ export interface Config extends CafeBotDrawConfig {
9
+ }
10
+ export declare const Config: Schema<Config>;
11
+ export declare function apply(ctx: Context, config: Config): Promise<void>;
@@ -0,0 +1,2 @@
1
+ declare function HtmlCreator(cardList: any): string;
2
+ export default HtmlCreator;
package/lib/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ /**
2
+ * 主入口文件
3
+ */
1
4
  import { Context } from 'koishi';
2
5
  import { Config } from './config';
3
6
  export declare const name = "cafe-bot-exp";
4
- export declare const inject: string[];
5
7
  export * from "./config";
6
8
  export declare function apply(ctx: Context, config: Config): Promise<void>;
package/lib/index.js CHANGED
@@ -6,8 +6,8 @@ var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
8
  var __export = (target, all) => {
9
- for (var name2 in all)
10
- __defProp(target, name2, { get: all[name2], enumerable: true });
9
+ for (var name5 in all)
10
+ __defProp(target, name5, { get: all[name5], enumerable: true });
11
11
  };
12
12
  var __copyProps = (to, from, except, desc) => {
13
13
  if (from && typeof from === "object" || typeof from === "function") {
@@ -30,15 +30,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
+ Config: () => Config4,
34
+ apply: () => apply4,
35
+ name: () => name4
36
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+
39
+ // src/draw/index.ts
40
+ var draw_exports = {};
41
+ __export(draw_exports, {
33
42
  Config: () => Config,
34
43
  apply: () => apply,
35
44
  inject: () => inject,
36
45
  name: () => name
37
46
  });
38
- module.exports = __toCommonJS(src_exports);
39
- var import_koishi2 = require("koishi");
47
+ var fs = __toESM(require("fs/promises"));
48
+ var path = __toESM(require("path"));
49
+ var import_fs_promises = __toESM(require("fs.promises.exists"));
40
50
 
41
- // src/DailySeededName.ts
51
+ // src/common/DailySeededName.ts
42
52
  function DailySeededName(uid) {
43
53
  const now = /* @__PURE__ */ new Date();
44
54
  const utc = now.getTime() + now.getTimezoneOffset() * 6e4;
@@ -53,7 +63,7 @@ function DailySeededName(uid) {
53
63
  }
54
64
  __name(DailySeededName, "DailySeededName");
55
65
 
56
- // src/PseudoRandom.ts
66
+ // src/common/PseudoRandom.ts
57
67
  var UniformRandom = require("@stdlib/random-base-uniform");
58
68
  function stringToSeed(str) {
59
69
  let hash = 2166136261;
@@ -88,7 +98,7 @@ var PseudoRandom = class {
88
98
  };
89
99
  var PseudoRandom_default = PseudoRandom;
90
100
 
91
- // src/templete/html.ts
101
+ // src/draw/templete/html.ts
92
102
  function HtmlCreator(cardList) {
93
103
  const fullHtml = `
94
104
  <!DOCTYPE html>
@@ -98,104 +108,129 @@ function HtmlCreator(cardList) {
98
108
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
99
109
  <title>抽卡结果</title>
100
110
  <style>
101
- :root{
102
- --ur-color: #ff9900;
103
- --ssr-color: #ff4db8;
104
- --sr-color: #3399ff;
105
- --r-color: #eee;
106
- --n-color: #eee;
111
+ :root {
112
+ --ur-color: #ff9900;
113
+ --ssr-color: #ff4db8;
114
+ --sr-color: #3399ff;
115
+ --r-color: #eee;
116
+ --n-color: #eee;
107
117
  }
118
+
108
119
  body {
109
- font-family: Arial, sans-serif;
110
- background: #dceffc;
111
- background-image: url("https://cdn.trails-game.com/wp-content/uploads/2020/07/20_Sunshine.jpg");
112
- background-size: cover;
113
- margin: 0;
114
- padding: 0;
115
- height:100vh;
116
- width:100vw;
120
+ font-family: Arial, sans-serif;
121
+ background: #dceffc;
122
+ background-image: url("https://cdn.trails-game.com/wp-content/uploads/2020/07/20_Sunshine.jpg");
123
+ background-size: cover;
124
+ margin: 0;
125
+ padding: 0;
126
+ height: 100vh;
127
+ width: 100vw;
117
128
  }
129
+
118
130
  .gacha-wrapper {
119
- display: flex;
120
- justify-content: center;
121
- position: absolute;
122
- transform: translate(-50%,-50%);
123
- left:50%;
124
- top:50%;
131
+ display: flex;
132
+ justify-content: center;
133
+ position: absolute;
134
+ transform: translate(-50%, -50%);
135
+ left: 50%;
136
+ top: 50%;
137
+ width: calc(100% - 40px);
138
+ padding-left: 20px;
139
+ padding-right: 20px;
125
140
  }
141
+
126
142
  .gacha-container {
127
- display: flex;
128
- flex-wrap: wrap;
129
- gap: 20px;
130
- justify-content: center;
131
- width:750px;
143
+ display: flex;
144
+ flex-wrap: wrap;
145
+ gap: 20px;
146
+ justify-content: center;
147
+ width: 100%;
132
148
  }
149
+
133
150
  .card {
134
- background: #fff;
135
- border-radius: 10px;
136
- overflow: hidden;
137
- width: 120px !important;
138
- height: 145px !important;
139
- overflow: hidden;
140
- text-align: center;
141
- box-shadow: 1px 1px 3px rgb(122, 122, 122);
142
- border:3px solid #fff;
143
- transform: skew(-10deg);
144
- box-sizing: border-box;
151
+ background: #fff;
152
+ border-radius: 10px;
153
+ overflow: hidden;
154
+ width: 130px !important;
155
+ height: 155px !important;
156
+ overflow: hidden;
157
+ text-align: center;
158
+ box-shadow: 1px 1px 3px rgb(122, 122, 122);
159
+ border: 3px solid #fff;
160
+ transform: skew(-10deg);
161
+ box-sizing: border-box;
145
162
  }
146
163
 
147
- .card.rarity-5{
148
- box-shadow: 1px 1px 3px var(--ur-color);
149
- border:3px solid var(--ur-color);
164
+ .card.rarity-5 {
165
+ box-shadow: 1px 1px 3px var(--ur-color);
166
+ border: 3px solid var(--ur-color);
150
167
  }
151
168
 
152
- .card.rarity-4{
153
- box-shadow: 1px 1px 3px var(--ssr-color);
154
- border:3px solid var(--ssr-color)
169
+ .card.rarity-4 {
170
+ box-shadow: 1px 1px 3px var(--ssr-color);
171
+ border: 3px solid var(--ssr-color)
155
172
  }
156
173
 
157
- .card.rarity-3{
158
- box-shadow: 1px 1px 3px var(--sr-color);
159
- border:3px solid var(--sr-color)
174
+ .card.rarity-3 {
175
+ box-shadow: 1px 1px 3px var(--sr-color);
176
+ border: 3px solid var(--sr-color)
160
177
  }
161
178
 
162
- .card.rarity-2{
163
- box-shadow: 1px 1px 3px var(--r-color);
164
- border:3px solid var(--r-color)
179
+ .card.rarity-2 {
180
+ box-shadow: 1px 1px 3px var(--r-color);
181
+ border: 3px solid var(--r-color)
165
182
  }
166
183
 
167
- .card.rarity-1{
168
- box-shadow: 1px 1px 3px var(--n-color);
169
- border:3px solid var(--n-color);
184
+ .card.rarity-1 {
185
+ box-shadow: 1px 1px 3px var(--n-color);
186
+ border: 3px solid var(--n-color);
170
187
  }
171
-
188
+
172
189
  .card .card-img {
173
- position: absolute;
174
- left: 0;
175
- top:0;
176
- width: 100%;
177
- height:100px;
178
- transform:skew(10deg) scale(1.2);
179
- background-repeat: no-repeat !important;
180
- background-size: 100% !important;
190
+ position: absolute;
191
+ left: 0;
192
+ top: 0;
193
+ width: 100%;
194
+ height: 115px;
195
+ transform: skew(10deg) scale(1.2);
196
+ background-repeat: no-repeat !important;
197
+ background-size: 100% !important;
181
198
  }
182
199
 
183
200
  .rarity {
184
- position: absolute;
185
- bottom: 0px;
186
- padding: 5px;
187
- background: #34495e;
188
- font-weight: bold;
189
- width: 100%;
190
- text-align: center;
191
- border-top: 3px solid #fff;
201
+ position: absolute;
202
+ bottom: 0px;
203
+ padding: 5px;
204
+ background: #34495e;
205
+ font-weight: bold;
206
+ width: 100%;
207
+ text-align: center;
208
+ }
209
+
210
+ .rarity.rarity-5 {
211
+ color: var(--ur-color);
212
+ border-top: 3px solid var(--ur-color);
213
+ }
214
+
215
+ .rarity.rarity-4 {
216
+ color: var(--ssr-color);
217
+ border-top: 3px solid var(--ssr-color);
218
+ }
219
+
220
+ .rarity.rarity-3 {
221
+ color: var(--sr-color);
222
+ border-top: 3px solid var(--sr-color);
223
+ }
224
+
225
+ .rarity.rarity-2 {
226
+ color: var(--r-color);
227
+ border-top: 3px solid var(--r-color);
192
228
  }
193
229
 
194
- .rarity.rarity-5 { color: var(--ur-color); }
195
- .rarity.rarity-4 { color: var(--ssr-color); }
196
- .rarity.rarity-3 { color: var(--sr-color); }
197
- .rarity.rarity-2 { color: var(--r-color); }
198
- .rarity.rarity-1 { color: var(--n-color); }
230
+ .rarity.rarity-1 {
231
+ color: var(--n-color);
232
+ border-top: 3px solid var(--n-color);
233
+ }
199
234
  </style>
200
235
  </head>
201
236
  <body>
@@ -207,104 +242,52 @@ function HtmlCreator(cardList) {
207
242
  <div class="card rarity-${item.star}">
208
243
  <div class="card-img" style="background:url('${item.url}')"></div>
209
244
  <div class="rarity rarity-${item.star}">${item.starText}</div>
210
- </div>
211
- `;
212
- })}
245
+ </div>`;
246
+ }).join("")}
213
247
  </div>
214
248
  </div>
215
249
  </body>
216
- </html>
217
- `;
250
+ </html>`;
218
251
  return fullHtml;
219
252
  }
220
253
  __name(HtmlCreator, "HtmlCreator");
221
254
  var html_default = HtmlCreator;
222
255
 
223
- // src/index.ts
224
- var fs = __toESM(require("fs/promises"));
225
- var path = __toESM(require("path"));
226
- var import_fs_promises = __toESM(require("fs.promises.exists"));
227
-
228
- // src/config.ts
256
+ // src/draw/config.ts
229
257
  var import_koishi = require("koishi");
230
- var Config = import_koishi.Schema.intersect([
231
- import_koishi.Schema.object({
232
- baseDataUrl: import_koishi.Schema.string().description("数据链接").default("https://www.azimiao.com/kiseki.json"),
233
- ImageServer: import_koishi.Schema.string().description("图像生成服务器").default("http://127.0.0.1:3000/screenshot"),
234
- ImageServerAuth: import_koishi.Schema.string().description("图像生成服务器密码").default(""),
235
- MinCount: import_koishi.Schema.number().description("最小抽取次数").default(0),
236
- MaxCount: import_koishi.Schema.number().description("最大抽取次数").default(8),
237
- Star1Name: import_koishi.Schema.string().description("1星名称").default("N"),
238
- Star1Chance: import_koishi.Schema.number().description("1星概率").default(0.5),
239
- Star2Name: import_koishi.Schema.string().description("2星名称").default("R"),
240
- Star2Chance: import_koishi.Schema.number().description("2星概率").default(0.34),
241
- Star3Name: import_koishi.Schema.string().description("3星名称").default("SR"),
242
- Star3Chance: import_koishi.Schema.number().description("3星概率").default(0.22),
243
- Star4Name: import_koishi.Schema.string().description("4星名称").default("SSR"),
244
- Star4Chance: import_koishi.Schema.number().description("4星概率").default(0.12),
245
- Star5Name: import_koishi.Schema.string().description("5星名称").default("UR"),
246
- Star5Chance: import_koishi.Schema.number().description("5星概率").default(0.04)
247
- }).description("抽卡设置"),
248
- import_koishi.Schema.object({
249
- baseQuizUrl: import_koishi.Schema.string().description("答题数据 Url")
250
- }).description("答题配置")
251
- ]);
258
+ var CafeBotDrawConfig = import_koishi.Schema.object({
259
+ baseDataUrl: import_koishi.Schema.string().description("数据链接").default("https://www.azimiao.com/kiseki.json"),
260
+ ImageServer: import_koishi.Schema.string().description("图像生成服务器").default("http://127.0.0.1:3000/screenshot"),
261
+ ImageServerAuth: import_koishi.Schema.string().description("图像生成服务器密码").default(""),
262
+ MinCount: import_koishi.Schema.number().description("最小抽取次数").default(0),
263
+ MaxCount: import_koishi.Schema.number().description("最大抽取次数").default(8),
264
+ Star1Name: import_koishi.Schema.string().description("1星名称").default("N"),
265
+ Star1Chance: import_koishi.Schema.number().description("1星概率").default(0.5),
266
+ Star2Name: import_koishi.Schema.string().description("2星名称").default("R"),
267
+ Star2Chance: import_koishi.Schema.number().description("2星概率").default(0.34),
268
+ Star3Name: import_koishi.Schema.string().description("3星名称").default("SR"),
269
+ Star3Chance: import_koishi.Schema.number().description("3星概率").default(0.22),
270
+ Star4Name: import_koishi.Schema.string().description("4星名称").default("SSR"),
271
+ Star4Chance: import_koishi.Schema.number().description("4星概率").default(0.12),
272
+ Star5Name: import_koishi.Schema.string().description("5星名称").default("UR"),
273
+ Star5Chance: import_koishi.Schema.number().description("5星概率").default(0.04)
274
+ }).description("抽卡配置");
252
275
 
253
- // src/index.ts
254
- var cafebotCardData = [];
255
- var name = "cafe-bot-exp";
276
+ // src/common/at.ts
277
+ var import_koishi2 = require("koishi");
278
+ function At(argv, newLine = true) {
279
+ let AtStr = argv.session && !argv.session.isDirect ? `${import_koishi2.segment.at(argv.session.userId)}${newLine ? "\r\n" : ""}` : "";
280
+ return AtStr;
281
+ }
282
+ __name(At, "At");
283
+
284
+ // src/draw/index.ts
285
+ var name = "cafe-bot-exp.draw";
256
286
  var inject = ["http"];
257
- var catWords = [
258
- "喵呀呜~ ",
259
- "喵呀~呵",
260
- // 走这边。(带路时)
261
- "喵呀~~噢",
262
- // 说得没错。就是这样。
263
- "喵呀~嘎~",
264
- // 高兴的表现。
265
- "喵呀~~呵",
266
- // 稍等一下。(引起注意)
267
- "喵嘎",
268
- // 爪子痒痒了。(焦躁不安)
269
- "喵嘎~~ ",
270
- // 肚子饿了。
271
- "喵嘎呜~~",
272
- // 警戒的表现。
273
- "喵呜",
274
- // 困了。乏了。累了。
275
- "喵呜?",
276
- // 您是哪位?
277
- "喵呜—",
278
- // 是的。
279
- "喵噢?",
280
- // 怎么了?
281
- "喵—噢",
282
- // 呦,又见面了。 (短期内再会时的招呼)
283
- "喵—呵",
284
- // 好久不见了。还好吗?
285
- "喵~呜",
286
- // 再见
287
- "喵~噢",
288
- // 是,就是这样。(强烈肯定)
289
- "喵~~呵",
290
- // 你好。
291
- "呜咪嘎~ ",
292
- // 打哈欠。
293
- "咪呜?",
294
- // 你说什么?(听到坏话反问的语气)
295
- "咪~呜 ",
296
- // 肚子饿了。(幼猫语)
297
- "咪~~呵"
298
- // 对不起
299
- ];
287
+ var Config = CafeBotDrawConfig;
300
288
  var animals = ["瑟蕾奴", "可鲁贝洛斯", "捷欧", "基库", "蔡特", "柯贝", "古利亚诺斯", "小星", "影良", "fio", "xeros"];
301
- var starEnum = [
302
- 5,
303
- 4,
304
- 3,
305
- 2,
306
- 1
307
- ];
289
+ var starEnum = [5, 4, 3, 2, 1];
290
+ var cafebotCardData = [];
308
291
  function shuffleWithCustomRandom(array, rand) {
309
292
  for (let i = array.length - 1; i > 0; i--) {
310
293
  const a = rand();
@@ -319,7 +302,7 @@ async function downloadCardDataIfNotExist(ctx, config) {
319
302
  if (cafebotCardData != null && cafebotCardData.length > 0) {
320
303
  return;
321
304
  }
322
- const root = path.join(ctx.baseDir, "data", "cafe-bot-exp-data");
305
+ const root = path.join(ctx.baseDir, "data", `${name}-data`);
323
306
  await fs.mkdir(root, { recursive: true });
324
307
  const cardFilePath = path.join(root, "card.json");
325
308
  var a = await (0, import_fs_promises.default)(cardFilePath);
@@ -393,16 +376,7 @@ async function getCards(seed, ctx, config) {
393
376
  return result;
394
377
  }
395
378
  __name(getCards, "getCards");
396
- function At(argv, newLine = true) {
397
- let AtStr = argv.session && !argv.session.isDirect ? `${import_koishi2.segment.at(argv.session.userId)}${newLine ? "\r\n" : ""}` : "";
398
- return AtStr;
399
- }
400
- __name(At, "At");
401
379
  async function apply(ctx, config) {
402
- downloadCardDataIfNotExist(ctx, config);
403
- ctx.command("关于", "about").action(async (argv, _) => {
404
- argv.session?.send(`我是轨迹Cafe群聊机器人概念版~`);
405
- });
406
380
  ctx.command("轨迹抽卡/给我抽", "进行每日抽卡").action(async (argv, _) => {
407
381
  let seed = DailySeededName(argv.session.userId);
408
382
  console.log(`getcard for ${seed}`);
@@ -481,17 +455,156 @@ async function apply(ctx, config) {
481
455
  });
482
456
  return;
483
457
  });
458
+ }
459
+ __name(apply, "apply");
460
+
461
+ // src/cat/index.ts
462
+ var cat_exports = {};
463
+ __export(cat_exports, {
464
+ Config: () => Config2,
465
+ apply: () => apply2,
466
+ name: () => name2
467
+ });
468
+ var import_koishi4 = require("koishi");
469
+
470
+ // src/cat/config.ts
471
+ var import_koishi3 = require("koishi");
472
+ var CafeBotCatConfig = import_koishi3.Schema.object({
473
+ catName: import_koishi3.Schema.string().description("名称/占位").default("柯贝")
474
+ }).description("猫猫配置");
475
+
476
+ // src/cat/index.ts
477
+ var name2 = "cafe-bot-exp.cat";
478
+ var Config2 = CafeBotCatConfig;
479
+ var catWords = [
480
+ "喵呀呜~ ",
481
+ "喵呀~呵",
482
+ // 走这边。(带路时)
483
+ "喵呀~~噢",
484
+ // 说得没错。就是这样。
485
+ "喵呀~嘎~",
486
+ // 高兴的表现。
487
+ "喵呀~~呵",
488
+ // 稍等一下。(引起注意)
489
+ "喵嘎",
490
+ // 爪子痒痒了。(焦躁不安)
491
+ "喵嘎~~ ",
492
+ // 肚子饿了。
493
+ "喵嘎呜~~",
494
+ // 警戒的表现。
495
+ "喵呜",
496
+ // 困了。乏了。累了。
497
+ "喵呜?",
498
+ // 您是哪位?
499
+ "喵呜—",
500
+ // 是的。
501
+ "喵噢?",
502
+ // 怎么了?
503
+ "喵—噢",
504
+ // 呦,又见面了。 (短期内再会时的招呼)
505
+ "喵—呵",
506
+ // 好久不见了。还好吗?
507
+ "喵~呜",
508
+ // 再见
509
+ "喵~噢",
510
+ // 是,就是这样。(强烈肯定)
511
+ "喵~~呵",
512
+ // 你好。
513
+ "呜咪嘎~ ",
514
+ // 打哈欠。
515
+ "咪呜?",
516
+ // 你说什么?(听到坏话反问的语气)
517
+ "咪~呜 ",
518
+ // 肚子饿了。(幼猫语)
519
+ "咪~~呵"
520
+ // 对不起
521
+ ];
522
+ async function apply2(ctx) {
484
523
  ctx.command("黑猫柯贝/摸猫", "摸摸柯贝").action(async (argv, _) => {
485
- const random = new import_koishi2.Random(() => Math.random());
524
+ const random = new import_koishi4.Random(() => Math.random());
486
525
  let catWord = random.pick(catWords);
487
526
  argv.session?.send(`${At(argv)}🐱:${catWord}`);
488
527
  });
489
528
  }
490
- __name(apply, "apply");
529
+ __name(apply2, "apply");
530
+
531
+ // src/quiz/index.ts
532
+ var quiz_exports = {};
533
+ __export(quiz_exports, {
534
+ Config: () => Config3,
535
+ apply: () => apply3,
536
+ inject: () => inject2,
537
+ name: () => name3
538
+ });
539
+
540
+ // src/quiz/config.ts
541
+ var import_koishi5 = require("koishi");
542
+ var CafeBotQuizConfig = import_koishi5.Schema.object({
543
+ baseQuizUrl: import_koishi5.Schema.string().description("答题数据 Url").default("https://www.azimiao.com/quiz.json"),
544
+ maxQuizPerDay: import_koishi5.Schema.number().description("每日单人最大答题数").default(5),
545
+ redisServer: import_koishi5.Schema.string().description("redis服务器地址"),
546
+ // TODO: 计划: 分数存储使用 sqlite, 临时数据(如当前题目)用内存就行了?
547
+ redisAuth: import_koishi5.Schema.string().description("redis服务器密码")
548
+ }).description("答题配置");
549
+
550
+ // src/quiz/index.ts
551
+ var name3 = "cafe-bot-exp.quiz";
552
+ var inject2 = ["http"];
553
+ var Config3 = CafeBotQuizConfig;
554
+ var validOptions = {
555
+ "A": 0,
556
+ "B": 1,
557
+ "C": 2,
558
+ "D": 3,
559
+ "a": 0,
560
+ "b": 1,
561
+ "c": 2,
562
+ "d": 3,
563
+ "1": 0,
564
+ "2": 1,
565
+ "3": 2,
566
+ "4": 3
567
+ };
568
+ async function apply3(ctx, config) {
569
+ ctx.command("轨迹答题/出题").action(async (argv, _) => {
570
+ await argv.session?.send("开发中");
571
+ return;
572
+ });
573
+ ctx.command("轨迹答题/回答 <answer:text>", `使用"回答+选项"回答问题,如"回答 A"`).action(async (argv, answer) => {
574
+ await argv.session?.send("开发中");
575
+ return;
576
+ let selectNumber = -1;
577
+ if (answer in validOptions) {
578
+ selectNumber = validOptions[answer];
579
+ } else {
580
+ argv.session?.send(`${At(argv)}回答错误~`);
581
+ }
582
+ });
583
+ }
584
+ __name(apply3, "apply");
585
+
586
+ // src/config.ts
587
+ var import_koishi6 = require("koishi");
588
+ var Config4 = import_koishi6.Schema.intersect([
589
+ CafeBotDrawConfig.collapse(),
590
+ CafeBotQuizConfig.collapse(),
591
+ CafeBotCatConfig.collapse()
592
+ ]);
593
+
594
+ // src/index.ts
595
+ var name4 = "cafe-bot-exp";
596
+ async function apply4(ctx, config) {
597
+ ctx.plugin(draw_exports, config);
598
+ ctx.plugin(quiz_exports, config);
599
+ ctx.plugin(cat_exports, config);
600
+ ctx.command("关于", "about").action(async (argv, _) => {
601
+ argv.session?.send(`我是轨迹Cafe群聊机器人概念版~`);
602
+ });
603
+ }
604
+ __name(apply4, "apply");
491
605
  // Annotate the CommonJS export names for ESM import in node:
492
606
  0 && (module.exports = {
493
607
  Config,
494
608
  apply,
495
- inject,
496
609
  name
497
610
  });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 轨迹答题配置
3
+ */
4
+ import { Schema } from "koishi";
5
+ export interface CafeBotQuizConfig {
6
+ baseQuizUrl: string;
7
+ maxQuizPerDay: number;
8
+ redisServer: string;
9
+ redisAuth: string;
10
+ }
11
+ export declare const CafeBotQuizConfig: Schema<CafeBotQuizConfig>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 轨迹答题
3
+ */
4
+ import { Context, Schema } from 'koishi';
5
+ import { CafeBotQuizConfig } from './config';
6
+ export declare const name = "cafe-bot-exp.quiz";
7
+ export declare const inject: string[];
8
+ export interface Config extends CafeBotQuizConfig {
9
+ }
10
+ export declare const Config: Schema<Config>;
11
+ export declare function apply(ctx: Context, config: Config): Promise<void>;
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@azimiao/koishi-plugin-cafe-bot-exp",
3
3
  "description": "cafe bot experiment",
4
- "version": "0.0.5",
4
+ "version": "0.0.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Azimiao/koishi-plugin-cafe-bot-exp.git"
10
+ },
11
+ "author": {
12
+ "name": "WildRabbit",
13
+ "email": "admin@azimao.com",
14
+ "url": "https://www.azimiao.com"
15
+ },
7
16
  "files": [
8
17
  "lib",
9
18
  "dist"
@@ -19,7 +28,7 @@
19
28
  },
20
29
  "koishi": {
21
30
  "description": {
22
- "zh": "轨迹Cafe概念版"
31
+ "zh": "轨迹CafeBot概念版"
23
32
  },
24
33
  "service": {
25
34
  "required": [
@@ -35,4 +44,4 @@
35
44
  "@stdlib/random-base-uniform": "^0.2.1",
36
45
  "fs.promises.exists": "^1.1.4"
37
46
  }
38
- }
47
+ }
package/readme.md DELETED
@@ -1,5 +0,0 @@
1
- # koishi-plugin-cafe-bot-exp
2
-
3
- [![npm](https://img.shields.io/npm/v/koishi-plugin-cafe-bot-exp?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-cafe-bot-exp)
4
-
5
- cafe bot experiment