@azimiao/koishi-plugin-cafe-bot-exp 0.0.28 → 0.0.32

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/lib/index.js CHANGED
@@ -40,7 +40,7 @@ module.exports = __toCommonJS(src_exports);
40
40
  var import_url = require("url");
41
41
 
42
42
  // package.json
43
- var version = "0.0.28";
43
+ var version = "0.0.32";
44
44
 
45
45
  // src/index.ts
46
46
  var import_censor = require("@koishijs/censor");
@@ -524,7 +524,9 @@ var CafeBotQuizConfig = import_koishi3.Schema.object({
524
524
  qqQuizMDTextID: import_koishi3.Schema.string().description("QQ markdown 纯本文模板ID"),
525
525
  qqQuizMDImgID: import_koishi3.Schema.string().description("QQ markdown 题目带图模板ID"),
526
526
  qqQuizButtonID: import_koishi3.Schema.string().description("QQ按钮ID"),
527
- appendMDBtn: import_koishi3.Schema.boolean().description("是否追加QQ按钮").default(false)
527
+ appendMDBtn: import_koishi3.Schema.boolean().description("是否追加QQ按钮").default(false),
528
+ imgWidth: import_koishi3.Schema.number().description("QQ图像宽度").default(0),
529
+ imgHeight: import_koishi3.Schema.number().description("QQ图像高度").default(0)
528
530
  }).description("答题配置");
529
531
 
530
532
  // src/common/CafeTimeTools.ts
@@ -688,14 +690,17 @@ async function apply2(ctx, config) {
688
690
  }
689
691
  await ctx.cache.set("question", argv.session.userId, { question: randomId, answer: answerIndex }, config.answerTimeout * 1e3);
690
692
  var msgQQ = {
693
+ content: "111",
691
694
  msg_type: 2,
692
695
  msg_id: argv.session.messageId,
696
+ timestamp: argv.session.timestamp,
693
697
  markdown: {
694
698
  custom_template_id: `${qItem.question.img.length > 0 ? config.qqQuizMDImgID : config.qqQuizMDTextID}`,
695
699
  params: [
696
700
  {
697
701
  key: "user",
698
- values: [`${argv.session.userId}`]
702
+ values: [argv.session && !argv.session.isDirect ? `<qqbot-at-user id="${argv.session.userId}"` : ""]
703
+ // 群聊能@,私聊不能@
699
704
  },
700
705
  {
701
706
  key: "question",
@@ -724,6 +729,20 @@ async function apply2(ctx, config) {
724
729
  ]
725
730
  }
726
731
  };
732
+ if (qItem.question.img.length > 0) {
733
+ msgQQ.markdown.params.push({
734
+ key: "img_url",
735
+ values: [qItem.question.img]
736
+ });
737
+ msgQQ.markdown.params.push({
738
+ key: "img_width",
739
+ values: [config.imgWidth]
740
+ });
741
+ msgQQ.markdown.params.push({
742
+ key: "img_height",
743
+ values: [config.imgHeight]
744
+ });
745
+ }
727
746
  if (config.appendMDBtn) {
728
747
  msgQQ.keyboard = {
729
748
  id: config.qqQuizButtonID
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azimiao/koishi-plugin-cafe-bot-exp",
3
3
  "description": "cafe bot experiment",
4
- "version": "0.0.28",
4
+ "version": "0.0.32",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "repository": {
@@ -1,9 +0,0 @@
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
- }>>;
@@ -1,15 +0,0 @@
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 const injectDepend: {
11
- required: any[];
12
- optional: string[];
13
- };
14
- export declare const inject: any[];
15
- export declare function apply(ctx: Context): Promise<void>;
@@ -1,4 +0,0 @@
1
- declare const CafeTimeTools: {
2
- getRemainingSecondsToBeijingMidnight: () => number;
3
- };
4
- export default CafeTimeTools;
@@ -1 +0,0 @@
1
- export declare function DailySeededName(uid: any): string;
@@ -1,11 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export declare function At(argv: any, newLine?: boolean): string;
@@ -1,3 +0,0 @@
1
- import { HTTP } from "koishi";
2
- declare function downloadFileIfNotExist(http: HTTP, downloadUrl: string, savePath: string, forceUpdate: boolean): Promise<boolean>;
3
- export default downloadFileIfNotExist;
package/lib/config.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { Schema } from "koishi";
2
- import { CafeBotDrawConfig } from "./draw/config";
3
- import { CafeBotQuizConfig } from "./quiz/config";
4
- import { CafeBotCatConfig } from "./cat/config";
5
- export interface CafeBotConfig {
6
- logoUrl: string;
7
- refreshLogoWhenLoad: boolean;
8
- useLocalLogoFile: boolean;
9
- }
10
- export type Config = CafeBotConfig & CafeBotDrawConfig & CafeBotQuizConfig & CafeBotCatConfig;
11
- export declare const Config: Schema<Config>;
@@ -1,24 +0,0 @@
1
- /**
2
- * 轨迹抽卡配置
3
- */
4
- import { Schema } from "koishi";
5
- export interface CafeBotDrawConfig {
6
- baseDataUrl: string;
7
- forceUpdateDataWhenLoad: boolean;
8
- ImageServer: string;
9
- ImageServerAuth: string;
10
- ImageNoCache: boolean;
11
- MinCount: number;
12
- MaxCount: number;
13
- Star1Name: string;
14
- Star1Chance: number;
15
- Star2Name: string;
16
- Star2Chance: number;
17
- Star3Name: string;
18
- Star3Chance: number;
19
- Star4Name: string;
20
- Star4Chance: number;
21
- Star5Name: string;
22
- Star5Chance: number;
23
- }
24
- export declare const CafeBotDrawConfig: Schema<CafeBotDrawConfig>;
@@ -1,15 +0,0 @@
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 injectDepend: {
8
- required: string[];
9
- optional: string[];
10
- };
11
- export declare const inject: string[];
12
- export interface Config extends CafeBotDrawConfig {
13
- }
14
- export declare const Config: Schema<Config>;
15
- export declare function apply(ctx: Context, config: Config): Promise<void>;
@@ -1,2 +0,0 @@
1
- declare function HtmlCreator(cardList: any): string;
2
- export default HtmlCreator;
package/lib/index.d.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * 主入口文件
3
- */
4
- import { Context } from 'koishi';
5
- import { Config } from './config';
6
- import '@koishijs/censor';
7
- import * as draw from "./draw/index";
8
- import * as quiz from "./quiz/index";
9
- import * as cat from "./cat/index";
10
- export declare const name = "cafe-bot-exp";
11
- export * from "./config";
12
- export declare const plugins: (typeof draw | typeof quiz | typeof cat)[];
13
- export declare const inject: {
14
- required: any[];
15
- optional: string[];
16
- };
17
- export declare function apply(ctx: Context, config: Config): Promise<void>;
@@ -1,17 +0,0 @@
1
- /**
2
- * 轨迹答题配置
3
- */
4
- import { Schema } from "koishi";
5
- export interface CafeBotQuizConfig {
6
- baseQuizUrl: string;
7
- forceUpdateWhenLoad: boolean;
8
- answerTimeout: number;
9
- maxQuizPerDay: number;
10
- redisServer: string;
11
- redisAuth: string;
12
- qqQuizMDTextID: string;
13
- qqQuizMDImgID: string;
14
- qqQuizButtonID: string;
15
- appendMDBtn: boolean;
16
- }
17
- export declare const CafeBotQuizConfig: Schema<CafeBotQuizConfig>;
@@ -1,37 +0,0 @@
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 injectDepend: {
8
- required: string[];
9
- optional: string[];
10
- };
11
- export declare const inject: string[];
12
- export interface Config extends CafeBotQuizConfig {
13
- }
14
- export declare const Config: Schema<Config>;
15
- interface QuestionCache {
16
- question: number;
17
- answer: number;
18
- }
19
- declare module '@koishijs/cache' {
20
- interface Tables {
21
- question: QuestionCache;
22
- todayCache: number;
23
- }
24
- }
25
- declare module 'koishi' {
26
- interface Tables {
27
- 'cafeQuiz': CafeQuiz;
28
- }
29
- }
30
- export interface CafeQuiz {
31
- id: number;
32
- userId: string;
33
- right: number;
34
- wrong: number;
35
- }
36
- export declare function apply(ctx: Context, config: Config): Promise<void>;
37
- export {};