kotori-plugin-penis 1.2.2 → 1.2.3
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 +5 -5
- package/lib/index.js +33 -33
- package/package.json +3 -3
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").
|
|
6
|
-
min: import("kotori-bot").
|
|
7
|
-
joke: import("kotori-bot").
|
|
8
|
-
avgMinNum: import("kotori-bot").
|
|
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,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
3
|
* @Package kotori-plugin-penis
|
|
4
|
-
* @Version 1.2.
|
|
5
|
-
* @Author Himeno <
|
|
4
|
+
* @Version 1.2.3
|
|
5
|
+
* @Author Himeno <me@hotaru.icu>
|
|
6
6
|
* @Copyright 2024 Hotaru. All rights reserved.
|
|
7
7
|
* @License GPL-3.0
|
|
8
8
|
* @Link https://github.com/kotorijs/kotori
|
|
9
|
-
* @Date 2024/
|
|
9
|
+
* @Date 2024/8/8 20:54:12
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
"use strict";
|
|
@@ -39,10 +39,10 @@ var import_kotori_bot = require("kotori-bot");
|
|
|
39
39
|
const lang = [__dirname, "../locales"];
|
|
40
40
|
const inject = ["file", "server"];
|
|
41
41
|
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)
|
|
42
|
+
max: import_kotori_bot.Tsu.Number().default(30).describe("The maximum length of the dick"),
|
|
43
|
+
min: import_kotori_bot.Tsu.Number().default(-30).describe("The minimum length of the dick"),
|
|
44
|
+
joke: import_kotori_bot.Tsu.Number().default(10).describe("Send a joke when the length is less than value"),
|
|
45
|
+
avgMinNum: import_kotori_bot.Tsu.Number().default(5).describe("The minimum at avg rank")
|
|
46
46
|
});
|
|
47
47
|
function main(ctx, config2) {
|
|
48
48
|
const getNewLength = () => config2.min + Math.floor(Math.random() * (config2.max - config2.min + 1));
|
|
@@ -51,16 +51,11 @@ function main(ctx, config2) {
|
|
|
51
51
|
const saveTodayData = (data) => ctx.file.save(getTodayPath(), data);
|
|
52
52
|
const loadStatData = () => ctx.file.load("stat.json", "json", {});
|
|
53
53
|
const saveStatData = (data) => ctx.file.save("stat.json", data);
|
|
54
|
-
ctx.
|
|
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) => {
|
|
54
|
+
ctx.command("dick - \u83B7\u53D6\u4ECA\u65E5\u725B\u725B\u957F\u5EA6").shortcut("\u4ECA\u65E5\u957F\u5EA6").action((_, session) => {
|
|
60
55
|
const id = `${session.api.adapter.identity}${session.userId}`;
|
|
61
56
|
const today = loadTodayData();
|
|
62
57
|
const todayLength = typeof today[id] === "number" ? today[id] : getNewLength();
|
|
63
|
-
const params = [
|
|
58
|
+
const params = [import_kotori_bot.Messages.mention(session.userId), todayLength];
|
|
64
59
|
if (todayLength <= 0) session.quick(["newnew.msg.today_length.info.2", params]);
|
|
65
60
|
else if (todayLength > 0 && todayLength <= config2.joke) session.quick(["newnew.msg.today_length.info.1", params]);
|
|
66
61
|
else session.quick(["newnew.msg.today_length.info.0", params]);
|
|
@@ -79,31 +74,36 @@ function main(ctx, config2) {
|
|
|
79
74
|
}
|
|
80
75
|
saveStatData(stat);
|
|
81
76
|
});
|
|
82
|
-
ctx.
|
|
77
|
+
ctx.command("my_dick - \u83B7\u53D6\u6211\u7684\u725B\u725B\u957F\u5EA6").shortcut("\u6211\u7684\u957F\u5EA6").action((_, session) => {
|
|
83
78
|
const stat = loadStatData();
|
|
84
79
|
const person = stat[`${session.api.adapter.identity}${session.userId}`];
|
|
85
|
-
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
[
|
|
89
|
-
|
|
80
|
+
const params = [import_kotori_bot.Messages.mention(session.userId)];
|
|
81
|
+
if (!person || person.length <= 0) return session.format("newnew.msg.my_length.fail", params);
|
|
82
|
+
return session.format("newnew.msg.my_length", [
|
|
83
|
+
params[0],
|
|
84
|
+
person[1],
|
|
85
|
+
person[0],
|
|
86
|
+
person[2],
|
|
87
|
+
person[3],
|
|
88
|
+
(person[3] / person[2]).toFixed(2)
|
|
89
|
+
]);
|
|
90
90
|
});
|
|
91
|
-
ctx.
|
|
91
|
+
ctx.command("avg_dick - \u67E5\u770B\u725B\u725B\u957F\u5EA6\u5E73\u5747\u6392\u884C").shortcut("\u5E73\u5747\u6392\u884C").action((_, session) => {
|
|
92
92
|
const stat = loadStatData();
|
|
93
93
|
const statOrigin = loadStatData();
|
|
94
94
|
if (Object.keys(stat).length <= 0) return "newnew.msg.avg_ranking.fail";
|
|
95
|
-
|
|
95
|
+
for (const key in stat) {
|
|
96
96
|
const item = stat[key];
|
|
97
97
|
item[3] /= item[2];
|
|
98
|
-
}
|
|
98
|
+
}
|
|
99
99
|
const entries = Object.entries(stat).filter((val) => val[0].startsWith(session.api.adapter.identity));
|
|
100
100
|
entries.sort((a, b) => b[1][3] - a[1][3]);
|
|
101
101
|
let list = "";
|
|
102
102
|
let num = 1;
|
|
103
|
-
|
|
104
|
-
if (num > 20)
|
|
103
|
+
for (const entry of entries) {
|
|
104
|
+
if (num > 20) continue;
|
|
105
105
|
const nums = entry[1][2];
|
|
106
|
-
if (nums < config2.avgMinNum)
|
|
106
|
+
if (nums < config2.avgMinNum) continue;
|
|
107
107
|
list += session.format("newnew.msg.avg_ranking.list", [
|
|
108
108
|
num,
|
|
109
109
|
entry[0].slice(session.api.adapter.identity.length),
|
|
@@ -112,26 +112,26 @@ function main(ctx, config2) {
|
|
|
112
112
|
statOrigin[entry[0]][3]
|
|
113
113
|
]);
|
|
114
114
|
num += 1;
|
|
115
|
-
}
|
|
116
|
-
return
|
|
115
|
+
}
|
|
116
|
+
return session.format("newnew.msg.avg_ranking", [list]);
|
|
117
117
|
});
|
|
118
|
-
ctx.
|
|
118
|
+
ctx.command("today_dick - \u67E5\u770B\u725B\u725B\u957F\u5EA6\u4ECA\u65E5\u6392\u884C").shortcut("\u4ECA\u65E5\u957F\u5EA6").action((_, session) => {
|
|
119
119
|
const today = loadTodayData();
|
|
120
120
|
if (today.length <= 0) return "newnew.msg.today_ranking.fail";
|
|
121
121
|
const entries = Object.entries(today).filter((val) => val[0].startsWith(session.api.adapter.identity));
|
|
122
122
|
entries.sort((a, b) => b[1] - a[1]);
|
|
123
123
|
let list = "";
|
|
124
124
|
let num = 1;
|
|
125
|
-
|
|
126
|
-
if (num > 20)
|
|
125
|
+
for (const entry of entries) {
|
|
126
|
+
if (num > 20) continue;
|
|
127
127
|
list += session.format("newnew.msg.today_ranking.list", [
|
|
128
128
|
num,
|
|
129
129
|
entry[0].slice(session.api.adapter.identity.length),
|
|
130
130
|
entry[1]
|
|
131
131
|
]);
|
|
132
132
|
num += 1;
|
|
133
|
-
}
|
|
134
|
-
return
|
|
133
|
+
}
|
|
134
|
+
return session.format("newnew.msg.today_ranking", [list]);
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
// 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.
|
|
3
|
+
"version": "1.2.3",
|
|
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 <
|
|
18
|
+
"author": "Himeno <me@hotaru.icu>",
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"kotori-bot": "^1.
|
|
20
|
+
"kotori-bot": "^1.6.0-rc.1"
|
|
21
21
|
},
|
|
22
22
|
"kotori": {
|
|
23
23
|
"meta": {
|