kotori-plugin-penis 1.4.0 → 1.5.0

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.
Files changed (2) hide show
  1. package/lib/index.js +35 -10
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * @Package kotori-plugin-penis
3
- * @Version 1.4.0
3
+ * @Version 1.5.0
4
4
  * @Author Himeno <me@hotaru.icu>
5
5
  * @Copyright 2024-2025 Hotaru. All rights reserved.
6
6
  * @License GPL-3.0
7
7
  * @Link https://github.com/kotorijs/kotori
8
- * @Date 2026/8/2 15:30:58
8
+ * @Date 2026/8/2 15:56:04
9
9
  */
10
10
  "use strict";
11
11
  var __defProp = Object.defineProperty;
@@ -50,7 +50,11 @@ const config = import_kotori_bot.Tsu.Object({
50
50
  });
51
51
  function main(ctx, config2) {
52
52
  const getNewLength = () => config2.min + Math.floor(Math.random() * (config2.max - config2.min + 1));
53
- const getNewThickness = () => config2.minThickness * 10 + Math.random() * (config2.maxThickness * 10 - config2.minThickness * 10) / 10;
53
+ const getNewThickness = () => Number(
54
+ (config2.minThickness * 10 + Math.random() * (config2.maxThickness * 10 - config2.minThickness * 10) / 10).toFixed(
55
+ 2
56
+ )
57
+ );
54
58
  const getTodayPath = () => `${(/* @__PURE__ */ new Date()).getFullYear()}-${(/* @__PURE__ */ new Date()).getMonth() + 1}-${(/* @__PURE__ */ new Date()).getDay()}.json`;
55
59
  const loadTodayData = () => ctx.file.load(getTodayPath(), "json", {});
56
60
  const saveTodayData = (data) => ctx.file.save(getTodayPath(), data);
@@ -134,7 +138,11 @@ function main(ctx, config2) {
134
138
  let num = 1;
135
139
  for (const entry of entries) {
136
140
  if (num > 20) continue;
137
- list += session.format("newnew.msg.today_ranking.list", [num, entry[0].slice(session.api.adapter.identity.length), entry[1][0]]);
141
+ list += session.format("newnew.msg.today_ranking.list", [
142
+ num,
143
+ entry[0].slice(session.api.adapter.identity.length),
144
+ entry[1][0]
145
+ ]);
138
146
  num += 1;
139
147
  }
140
148
  return session.format("newnew.msg.today_ranking", [list]);
@@ -152,7 +160,7 @@ function main(ctx, config2) {
152
160
  const targetId = args[0] ?? session.userId;
153
161
  const params = [import_kotori_bot.Messages.mention(targetId), import_kotori_bot.Messages.mention(session.userId)];
154
162
  if (senderRecord.given >= config2.maxCount) {
155
- return session.quick(["{1} \u4F60\u4ECA\u5929\u5DF2\u7ECF\u793E\u4E86 {0} \u6B21\u4E86\uFF0C\u8EAB\u4F53\u8981\u88AB\u638F\u7A7A\u4E86\u54E6\uFF01\u4F11\u606F\u4E0B\u5427\u3002", [config2.maxCount, params[1]]]);
163
+ return session.quick(["{1} \u4F60\u4ECA\u5929\u5DF2\u7ECF {0} \u6B21\u4E86\uFF0C\u8EAB\u4F53\u8981\u88AB\u638F\u7A7A\u4E86\u54E6\uFF01\u4F11\u606F\u4E0B\u5427\u3002", [config2.maxCount, params[1]]]);
156
164
  }
157
165
  const lengthData = loadTodayData();
158
166
  const targetFullId = `${session.api.adapter.identity}${targetId}`;
@@ -164,11 +172,29 @@ function main(ctx, config2) {
164
172
  })()
165
173
  );
166
174
  if (senderLength === 0) return session.quick(["{1} \u4F60\u6CA1\u6709\u6B66\u5668\u554A\uFF01\u60F3\u4EC0\u4E48\u4E86\uFF01", params]);
175
+ if (targetId === session.userId) {
176
+ const cutFailed = Math.random() < config2.cutProbability;
177
+ if (targetLength > 0 && cut) {
178
+ session.quick([cutFailed ? "{1} \u4F60\u6CA1\u5FCD\u4F4F\uFF01\u793E\u4FDD\u4E86\uFF01" : "{1} \u4F60\u6210\u529F\u5BF8\u6B62\u4E86\uFF01", params]);
179
+ }
180
+ if (targetLength > 0) session.quick(["{1} \u8D77\u98DE\u6210\u529F\uFF01\u72B6\u6001\u826F\u597D\uFF01", params]);
181
+ else session.quick(["{1} \u6316\u5751\u6210\u529F\uFF01\u611F\u89C9\u826F\u597D\uFF01", params]);
182
+ if (!cut || cutFailed) {
183
+ senderRecord.given += 1;
184
+ senderRecord.lastTime = Date.now();
185
+ data[senderId] = senderRecord;
186
+ saveData(data);
187
+ }
188
+ return;
189
+ }
167
190
  if (targetLength === 0) return session.quick(["{0} \u662F\u5E73\u7684\u554A\uFF01\u4F60\u5E72\u4EC0\u4E48\u4E86\uFF01", params]);
168
- if (targetLength * senderLength < 0) return session.quick(["\u7FA4\u53CB {0} \u548C {1} \u4F60\u90FD\u662F\u53EF\u7231\u7684\u5973\u5B69\u5B50\u5662( \u2022\u0300 \u03C9 \u2022\u0301 )\u2727\uFF0C\u65E0\u6CD5\u8FDB\u884C\u793E\u4FDD\uFF01", params]);
169
- if (targetLength > 0 && senderLength < 0) return session.quick(["\u4F60\u5728\u60F3\u4EC0\u4E48\uFF1F\uFF1F{1} \u4F60\u662F\u53EF\u7231\u7684\u5973\u5B69\u5B50\u554A( \u2022\u0300 \u03C9 \u2022\u0301 )\u2727", params]);
191
+ if (targetLength * senderLength < 0)
192
+ return session.quick(["\u7FA4\u53CB {0} \u548C {1} \u4F60\u90FD\u662F\u53EF\u7231\u7684\u5973\u5B69\u5B50\u5662( \u2022\u0300 \u03C9 \u2022\u0301 )\u2727\uFF0C\u65E0\u6CD5\u8FDB\u884C\u793E\u4FDD\uFF01", params]);
193
+ if (targetLength > 0 && senderLength < 0)
194
+ return session.quick(["\u4F60\u5728\u60F3\u4EC0\u4E48\uFF1F\uFF1F{1} \u4F60\u662F\u53EF\u7231\u7684\u5973\u5B69\u5B50\u554A( \u2022\u0300 \u03C9 \u2022\u0301 )\u2727", params]);
170
195
  if (targetLength * senderLength > 0) return session.quick(["\uFF1F\uFF1F\u6960\u6960\uFF1F\uFF1F\u7EDD\u5BF9\u4E0D\u884C\uFF01{1}", params]);
171
- if (targetThickness < senderThickness) return session.quick(["\u7FA4\u53CB {0} \u7684OO\u592A\u5C0F\u4E86\uFF0C{1} \u4F60\u7684\u793E\u4FDD\u65E0\u6CD5\u8FDB\u5165\uFF01", params]);
196
+ if (targetThickness < senderThickness)
197
+ return session.quick(["\u7FA4\u53CB {0} \u7684OO\u592A\u5C0F\u4E86\uFF0C{1} \u4F60\u7684\u793E\u4FDD\u65E0\u6CD5\u8FDB\u5165\uFF01", params]);
172
198
  const targetRecord = data[targetFullId] || { given: 0, received: 0, lastTime: 0 };
173
199
  if (targetRecord.lastTime < todayStart) {
174
200
  targetRecord.given = 0;
@@ -178,7 +204,6 @@ function main(ctx, config2) {
178
204
  if (targetRecord.received >= config2.maxCount2) {
179
205
  return session.quick(["\u7FA4\u53CB {0} \u7684\u5C0F\u809A\u809A\u5DF2\u7ECF\u88C5\u4E0D\u4E0B\u4E86\uFF0C{1} \u8BF7\u4E0D\u8981\u518D\u793E\u4E86\uFF01", params]);
180
206
  }
181
- const cutFailed = Math.random() < config2.cutProbability;
182
207
  const noPregnancy = Math.random() < config2.probability;
183
208
  const babyTypes = [
184
209
  "\u4E00\u53EA\u7537\u5A03",
@@ -195,7 +220,7 @@ function main(ctx, config2) {
195
220
  ];
196
221
  const pickBaby = () => babyTypes[Math.floor(Math.random() * babyTypes.length)];
197
222
  if (cut) {
198
- if (cutFailed) {
223
+ if (Math.random() < config2.cutProbability) {
199
224
  senderRecord.given++;
200
225
  targetRecord.received++;
201
226
  const babyStr = noPregnancy ? "\u5E86\u5E78\u7684\u662F\u6CA1\u6709\u6000\u5B55" : `\u7FA4\u53CB\u8BDE\u4E0B\u4E86 ${pickBaby()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kotori-plugin-penis",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "查看今日牛牛的长度和排行和寸止",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [