koishi-plugin-cat-raising 0.0.1
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 +9 -0
- package/lib/index.js +59 -0
- package/package.json +20 -0
- package/readme.md +5 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Context, Schema } from 'koishi';
|
|
2
|
+
export declare const name = "cat-raising";
|
|
3
|
+
export interface Config {
|
|
4
|
+
targetQQ: string;
|
|
5
|
+
isGroup: boolean;
|
|
6
|
+
debugMode: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const Config: Schema<Config>;
|
|
9
|
+
export declare function apply(ctx: Context, config: Config): void;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name2 in all)
|
|
8
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
Config: () => Config,
|
|
24
|
+
apply: () => apply,
|
|
25
|
+
name: () => name
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
var import_koishi = require("koishi");
|
|
29
|
+
var name = "cat-raising";
|
|
30
|
+
var Config = import_koishi.Schema.object({
|
|
31
|
+
targetQQ: import_koishi.Schema.string().description("目标QQ号或QQ群号").required(),
|
|
32
|
+
isGroup: import_koishi.Schema.boolean().description("是否为QQ群").default(false),
|
|
33
|
+
debugMode: import_koishi.Schema.boolean().description("调试模式(在原消息处发送转发内容)").default(false)
|
|
34
|
+
});
|
|
35
|
+
function apply(ctx, config) {
|
|
36
|
+
ctx.on("message", (session) => {
|
|
37
|
+
const message = session.content;
|
|
38
|
+
if (!message.includes("神金")) return;
|
|
39
|
+
const numberRegex = /\d{6,15}/;
|
|
40
|
+
if (!numberRegex.test(message)) return;
|
|
41
|
+
const forwardMessage = message;
|
|
42
|
+
if (config.isGroup) {
|
|
43
|
+
session.bot.sendMessage(config.targetQQ, forwardMessage);
|
|
44
|
+
} else {
|
|
45
|
+
session.bot.sendPrivateMessage(config.targetQQ, forwardMessage);
|
|
46
|
+
}
|
|
47
|
+
const replyMessage = config.debugMode ? `🐱 调试模式 - 检测到神金
|
|
48
|
+
📤 转发目标: ${config.targetQQ}${config.isGroup ? " (群聊)" : ""}
|
|
49
|
+
💬 转发内容: ${forwardMessage}` : "🐱 检测到神金 已执行转发~";
|
|
50
|
+
session.send(replyMessage);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
__name(apply, "apply");
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
Config,
|
|
57
|
+
apply,
|
|
58
|
+
name
|
|
59
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "koishi-plugin-cat-raising",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"chatbot",
|
|
14
|
+
"koishi",
|
|
15
|
+
"plugin"
|
|
16
|
+
],
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"koishi": "^4.18.7"
|
|
19
|
+
}
|
|
20
|
+
}
|