koishi-plugin-cocoyyy-console 1.0.8-beta.3 → 1.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/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Context, Logger, Schema } from 'koishi';
2
2
  import * as my_config from './utils/config';
3
3
  export declare const name = "cocoyyy-console";
4
+ export declare let dev_mode: boolean;
4
5
  export interface Config {
5
6
  function_config?: my_config.FunctionConfig;
6
7
  mysql_config?: my_config.MysqlConfig;
package/lib/index.js CHANGED
@@ -22,6 +22,7 @@ var src_exports = {};
22
22
  __export(src_exports, {
23
23
  Config: () => Config,
24
24
  apply: () => apply,
25
+ dev_mode: () => dev_mode,
25
26
  logger: () => logger,
26
27
  name: () => name,
27
28
  savePath: () => savePath
@@ -32,6 +33,7 @@ var import_koishi9 = require("koishi");
32
33
  // src/utils/configs/function_config.ts
33
34
  var import_koishi = require("koishi");
34
35
  var FunctionConfigSchema = import_koishi.Schema.object({
36
+ dev_mode: import_koishi.Schema.boolean().default(false).description("开发测试模式"),
35
37
  tag_flag: import_koishi.Schema.boolean().default(true).description("标签功能是否启用"),
36
38
  repeat_flag: import_koishi.Schema.boolean().default(true).description("复读功能是否启用"),
37
39
  rbq_flag: import_koishi.Schema.boolean().default(true).description("*人功能是否启用")
@@ -71,10 +73,10 @@ __name(resolveTagBaseDir, "resolveTagBaseDir");
71
73
  // src/utils/configs/repeat_config.ts
72
74
  var import_koishi4 = require("koishi");
73
75
  var RepeatConfigSchema = import_koishi4.Schema.object({
74
- minTimes: import_koishi4.Schema.number().default(1).description("最小重复次数"),
76
+ minTimes: import_koishi4.Schema.number().default(3).description("最小重复次数"),
75
77
  probability: import_koishi4.Schema.number().default(1).description("复读概率[0-1]"),
76
78
  guild_ids: import_koishi4.Schema.string().default("").description("不需要复读的群ID,多个群ID用逗号分隔"),
77
- resetInterval: import_koishi4.Schema.number().default(60).description("过期秒数")
79
+ resetInterval: import_koishi4.Schema.number().default(300).description("过期秒数")
78
80
  });
79
81
 
80
82
  // src/utils/configs/rbq_config.ts
@@ -262,7 +264,6 @@ function getImgsModel() {
262
264
  __name(getImgsModel, "getImgsModel");
263
265
 
264
266
  // src/utils/common.ts
265
- var dev_mode = false;
266
267
  function is_at_bot(session) {
267
268
  const elements = Array.isArray(session?.elements) ? session.elements : [];
268
269
  const atElement = elements.find((element) => element?.type === "at");
@@ -876,6 +877,7 @@ function registerRbqMiddleware(ctx, config) {
876
877
  const atElements = elements?.filter((el) => el.type === "at") || [];
877
878
  if (atElements.length === 0) return next();
878
879
  const matched = config.configList.find((item) => {
880
+ if (item.guild_id !== guildId) return false;
879
881
  const targetUid = item.uid?.trim();
880
882
  if (!targetUid) return false;
881
883
  const isAtTarget = atElements.some((el) => el.attrs?.id === targetUid);
@@ -884,7 +886,7 @@ function registerRbqMiddleware(ctx, config) {
884
886
  return Math.random() <= probability;
885
887
  });
886
888
  if (!matched) return next();
887
- const content = matched.content || "*死你";
889
+ const content = matched.content || "*你";
888
890
  session.send((0, import_koishi8.h)("at", { id: matched.uid.trim() }) + " " + content);
889
891
  return;
890
892
  });
@@ -918,6 +920,7 @@ __name(registerTestCommands, "registerTestCommands");
918
920
 
919
921
  // src/index.ts
920
922
  var name = "cocoyyy-console";
923
+ var dev_mode;
921
924
  var Config = import_koishi9.Schema.object({
922
925
  function_config: FunctionConfigSchema.description("功能开关配置"),
923
926
  mysql_config: MysqlConfigSchema.description("MySQL 数据库配置"),
@@ -929,6 +932,7 @@ var logger = new import_koishi9.Logger(name);
929
932
  var savePath = null;
930
933
  async function apply(ctx, config) {
931
934
  ctx = ctx.guild();
935
+ dev_mode = config.function_config.dev_mode;
932
936
  const mysqlConf = config?.mysql_config ?? loadMysqlConfigFromEnv();
933
937
  initSequelize(mysqlConf);
934
938
  const connected = await testConnect();
@@ -952,6 +956,7 @@ __name(apply, "apply");
952
956
  0 && (module.exports = {
953
957
  Config,
954
958
  apply,
959
+ dev_mode,
955
960
  logger,
956
961
  name,
957
962
  savePath
@@ -1,4 +1,3 @@
1
- declare let dev_mode: boolean;
2
1
  declare function is_at_bot(session: any): boolean;
3
2
  declare function decodeHtmlEntities(text: string): string;
4
- export { dev_mode, is_at_bot, decodeHtmlEntities };
3
+ export { is_at_bot, decodeHtmlEntities };
@@ -1,5 +1,6 @@
1
1
  import { Schema } from 'koishi';
2
2
  interface FunctionConfig {
3
+ dev_mode: boolean;
3
4
  tag_flag: boolean;
4
5
  repeat_flag: boolean;
5
6
  rbq_flag: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-cocoyyy-console",
3
3
  "description": "自用koishi插件,功能包含复读,记录黑历史,*人等",
4
- "version": "1.0.8-beta.3",
4
+ "version": "1.0.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "contributors": [