kotori-plugin-penis 1.2.2 → 1.2.4

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,11 +1,11 @@
1
- import { Context, Tsu } from 'kotori-bot';
1
+ import { type Context, Tsu } from 'kotori-bot';
2
2
  export declare const lang: string[];
3
3
  export declare const inject: string[];
4
4
  export declare const config: import("kotori-bot").ObjectParser<{
5
- max: import("kotori-bot").NumberParser;
6
- min: import("kotori-bot").NumberParser;
7
- joke: import("kotori-bot").NumberParser;
8
- avgMinNum: import("kotori-bot").NumberParser;
5
+ max: import("kotori-bot").Parser<number>;
6
+ min: import("kotori-bot").Parser<number>;
7
+ joke: import("kotori-bot").Parser<number>;
8
+ avgMinNum: import("kotori-bot").Parser<number>;
9
9
  }>;
10
10
  type Config = Tsu.infer<typeof config>;
11
11
  export declare function main(ctx: Context, config: Config): void;
package/lib/index.js CHANGED
@@ -1,14 +1,12 @@
1
-
2
1
  /**
3
- * @Package kotori-plugin-penis
4
- * @Version 1.2.1
5
- * @Author Himeno <biyuehuya@gmail.com>
6
- * @Copyright 2024 Hotaru. All rights reserved.
7
- * @License GPL-3.0
8
- * @Link https://github.com/kotorijs/kotori
9
- * @Date 2024/6/7 21:36:14
10
- */
11
-
2
+ * @Package kotori-plugin-penis
3
+ * @Version 1.2.3
4
+ * @Author Himeno <me@hotaru.icu>
5
+ * @Copyright 2024-2025 Hotaru. All rights reserved.
6
+ * @License BAN-ZHINESE-USING
7
+ * @Link https://github.com/kotorijs/kotori
8
+ * @Date 2025/8/4 17:28:33
9
+ */
12
10
  "use strict";
13
11
  var __defProp = Object.defineProperty;
14
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -27,22 +25,22 @@ var __copyProps = (to, from, except, desc) => {
27
25
  return to;
28
26
  };
29
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var src_exports = {};
31
- __export(src_exports, {
28
+ var index_exports = {};
29
+ __export(index_exports, {
32
30
  config: () => config,
33
31
  inject: () => inject,
34
32
  lang: () => lang,
35
33
  main: () => main
36
34
  });
37
- module.exports = __toCommonJS(src_exports);
35
+ module.exports = __toCommonJS(index_exports);
38
36
  var import_kotori_bot = require("kotori-bot");
39
37
  const lang = [__dirname, "../locales"];
40
38
  const inject = ["file", "server"];
41
39
  const config = import_kotori_bot.Tsu.Object({
42
- max: import_kotori_bot.Tsu.Number().default(30),
43
- min: import_kotori_bot.Tsu.Number().default(-30),
44
- joke: import_kotori_bot.Tsu.Number().default(10),
45
- avgMinNum: import_kotori_bot.Tsu.Number().default(5)
40
+ max: import_kotori_bot.Tsu.Number().default(30).describe("The maximum length of the dick"),
41
+ min: import_kotori_bot.Tsu.Number().default(-30).describe("The minimum length of the dick"),
42
+ joke: import_kotori_bot.Tsu.Number().default(10).describe("Send a joke when the length is less than value"),
43
+ avgMinNum: import_kotori_bot.Tsu.Number().default(5).describe("The minimum at avg rank")
46
44
  });
47
45
  function main(ctx, config2) {
48
46
  const getNewLength = () => config2.min + Math.floor(Math.random() * (config2.max - config2.min + 1));
@@ -51,16 +49,11 @@ function main(ctx, config2) {
51
49
  const saveTodayData = (data) => ctx.file.save(getTodayPath(), data);
52
50
  const loadStatData = () => ctx.file.load("stat.json", "json", {});
53
51
  const saveStatData = (data) => ctx.file.save("stat.json", data);
54
- ctx.midware((next, session) => {
55
- const s = session;
56
- if (s.message === `${s.api.adapter.config["command-prefix"]}\u4ECA\u65E5\u957F\u5EA6`) s.message = "\u4ECA\u65E5\u957F\u5EA6";
57
- next();
58
- });
59
- ctx.regexp(/^今日长度$/, (_, session) => {
52
+ ctx.command("dick - \u83B7\u53D6\u4ECA\u65E5\u725B\u725B\u957F\u5EA6").shortcut("\u4ECA\u65E5\u957F\u5EA6").action((_, session) => {
60
53
  const id = `${session.api.adapter.identity}${session.userId}`;
61
54
  const today = loadTodayData();
62
55
  const todayLength = typeof today[id] === "number" ? today[id] : getNewLength();
63
- const params = [session.el.at(session.userId), todayLength];
56
+ const params = [import_kotori_bot.Messages.mention(session.userId), todayLength];
64
57
  if (todayLength <= 0) session.quick(["newnew.msg.today_length.info.2", params]);
65
58
  else if (todayLength > 0 && todayLength <= config2.joke) session.quick(["newnew.msg.today_length.info.1", params]);
66
59
  else session.quick(["newnew.msg.today_length.info.0", params]);
@@ -79,31 +72,36 @@ function main(ctx, config2) {
79
72
  }
80
73
  saveStatData(stat);
81
74
  });
82
- ctx.regexp(/^我的长度$/, (_, session) => {
75
+ ctx.command("my_dick - \u83B7\u53D6\u6211\u7684\u725B\u725B\u957F\u5EA6").shortcut("\u6211\u7684\u957F\u5EA6").action((_, session) => {
83
76
  const stat = loadStatData();
84
77
  const person = stat[`${session.api.adapter.identity}${session.userId}`];
85
- if (!person || person.length <= 0) return ["newnew.msg.my_length.fail", [session.el.at(session.userId)]];
86
- return [
87
- "newnew.msg.my_length",
88
- [session.el.at(session.userId), person[1], person[0], person[2], person[3], (person[3] / person[2]).toFixed(2)]
89
- ];
78
+ const params = [import_kotori_bot.Messages.mention(session.userId)];
79
+ if (!person || person.length <= 0) return session.format("newnew.msg.my_length.fail", params);
80
+ return session.format("newnew.msg.my_length", [
81
+ params[0],
82
+ person[1],
83
+ person[0],
84
+ person[2],
85
+ person[3],
86
+ (person[3] / person[2]).toFixed(2)
87
+ ]);
90
88
  });
91
- ctx.regexp(/^平均排行$/, (_, session) => {
89
+ ctx.command("avg_dick - \u67E5\u770B\u725B\u725B\u957F\u5EA6\u5E73\u5747\u6392\u884C").shortcut("\u5E73\u5747\u6392\u884C").action((_, session) => {
92
90
  const stat = loadStatData();
93
91
  const statOrigin = loadStatData();
94
92
  if (Object.keys(stat).length <= 0) return "newnew.msg.avg_ranking.fail";
95
- Object.keys(stat).forEach((key) => {
93
+ for (const key in stat) {
96
94
  const item = stat[key];
97
95
  item[3] /= item[2];
98
- });
96
+ }
99
97
  const entries = Object.entries(stat).filter((val) => val[0].startsWith(session.api.adapter.identity));
100
98
  entries.sort((a, b) => b[1][3] - a[1][3]);
101
99
  let list = "";
102
100
  let num = 1;
103
- entries.forEach((entry) => {
104
- if (num > 20) return;
101
+ for (const entry of entries) {
102
+ if (num > 20) continue;
105
103
  const nums = entry[1][2];
106
- if (nums < config2.avgMinNum) return;
104
+ if (nums < config2.avgMinNum) continue;
107
105
  list += session.format("newnew.msg.avg_ranking.list", [
108
106
  num,
109
107
  entry[0].slice(session.api.adapter.identity.length),
@@ -112,26 +110,26 @@ function main(ctx, config2) {
112
110
  statOrigin[entry[0]][3]
113
111
  ]);
114
112
  num += 1;
115
- });
116
- return ["newnew.msg.avg_ranking", [list]];
113
+ }
114
+ return session.format("newnew.msg.avg_ranking", [list]);
117
115
  });
118
- ctx.regexp(/^今日排行$/, (_, session) => {
116
+ ctx.command("today_dick - \u67E5\u770B\u725B\u725B\u957F\u5EA6\u4ECA\u65E5\u6392\u884C").shortcut("\u4ECA\u65E5\u957F\u5EA6").action((_, session) => {
119
117
  const today = loadTodayData();
120
118
  if (today.length <= 0) return "newnew.msg.today_ranking.fail";
121
119
  const entries = Object.entries(today).filter((val) => val[0].startsWith(session.api.adapter.identity));
122
120
  entries.sort((a, b) => b[1] - a[1]);
123
121
  let list = "";
124
122
  let num = 1;
125
- entries.forEach((entry) => {
126
- if (num > 20) return;
123
+ for (const entry of entries) {
124
+ if (num > 20) continue;
127
125
  list += session.format("newnew.msg.today_ranking.list", [
128
126
  num,
129
127
  entry[0].slice(session.api.adapter.identity.length),
130
128
  entry[1]
131
129
  ]);
132
130
  num += 1;
133
- });
134
- return ["newnew.msg.today_ranking", [list]];
131
+ }
132
+ return session.format("newnew.msg.today_ranking", [list]);
135
133
  });
136
134
  }
137
135
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kotori-plugin-penis",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "查看今日牛牛的长度和排行",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [
@@ -15,9 +15,9 @@
15
15
  "LICENSE",
16
16
  "README.md"
17
17
  ],
18
- "author": "Himeno <biyuehuya@gmail.com>",
18
+ "author": "Himeno <me@hotaru.icu>",
19
19
  "peerDependencies": {
20
- "kotori-bot": "^1.5.4"
20
+ "kotori-bot": "^1.7.1"
21
21
  },
22
22
  "kotori": {
23
23
  "meta": {