koishi-plugin-bcjh-uidtransfer 0.0.1 → 0.0.2
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 +2 -2
- package/lib/index.js +6 -6
- package/package.json +2 -2
- package/readme.md +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { Context, Schema } from 'koishi';
|
|
|
2
2
|
export declare const name = "bcjh-uidtransfer";
|
|
3
3
|
export declare const inject: string[];
|
|
4
4
|
export interface Config {
|
|
5
|
-
|
|
5
|
+
adminID: string[];
|
|
6
6
|
monetaryName: string;
|
|
7
|
-
|
|
7
|
+
botID: string;
|
|
8
8
|
showPic: boolean;
|
|
9
9
|
}
|
|
10
10
|
export declare const Config: Schema<Config>;
|
package/lib/index.js
CHANGED
|
@@ -30,9 +30,9 @@ var import_koishi = require("koishi");
|
|
|
30
30
|
var name = "bcjh-uidtransfer";
|
|
31
31
|
var inject = ["database", "monetary"];
|
|
32
32
|
var Config = import_koishi.Schema.object({
|
|
33
|
-
|
|
33
|
+
adminID: import_koishi.Schema.array(String).role("table").description("管理员ID列表"),
|
|
34
34
|
monetaryName: import_koishi.Schema.string().default("货币").description("积分的名字"),
|
|
35
|
-
|
|
35
|
+
botID: import_koishi.Schema.string().default("").description("QQ官方机器人的 id (实现头像获取)"),
|
|
36
36
|
showPic: import_koishi.Schema.boolean().default(true).description("是否显示用户头像 (需绑定QQbotId)")
|
|
37
37
|
});
|
|
38
38
|
function apply(ctx, config) {
|
|
@@ -50,7 +50,7 @@ function apply(ctx, config) {
|
|
|
50
50
|
} else {
|
|
51
51
|
monetary = data.value;
|
|
52
52
|
}
|
|
53
|
-
const isAdmin = config.
|
|
53
|
+
const isAdmin = config.adminID.includes(session.userId);
|
|
54
54
|
const successMsg = isAdmin ? "获取管理员信息成功!" : "获取用户信息成功!";
|
|
55
55
|
const text = `${successMsg}
|
|
56
56
|
[uid] ${uid}
|
|
@@ -61,7 +61,7 @@ function apply(ctx, config) {
|
|
|
61
61
|
[持有${config.monetaryName}] ${monetary}`;
|
|
62
62
|
let message = "";
|
|
63
63
|
if (config.showPic) {
|
|
64
|
-
message += import_koishi.h.image(`http://q.qlogo.cn/qqapp/${config.
|
|
64
|
+
message += import_koishi.h.image(`http://q.qlogo.cn/qqapp/${config.botID}/${userId}/640`);
|
|
65
65
|
}
|
|
66
66
|
message += text;
|
|
67
67
|
return message;
|
|
@@ -102,7 +102,7 @@ function apply(ctx, config) {
|
|
|
102
102
|
const monetary = data.value;
|
|
103
103
|
let msg = "";
|
|
104
104
|
if (config.showPic && bindData) {
|
|
105
|
-
msg += import_koishi.h.image(`http://q.qlogo.cn/qqapp/${config.
|
|
105
|
+
msg += import_koishi.h.image(`http://q.qlogo.cn/qqapp/${config.botID}/${bindData.pid}/640`);
|
|
106
106
|
}
|
|
107
107
|
msg += `[?] 确认目标信息为:
|
|
108
108
|
[uid] ${data.uid}
|
|
@@ -118,7 +118,7 @@ function apply(ctx, config) {
|
|
|
118
118
|
return await transfer.getUserInfo(session);
|
|
119
119
|
});
|
|
120
120
|
ctx.command("添加积分 <uid:number> <num:number>").action(async ({ session }, uid, num) => {
|
|
121
|
-
if (!config.
|
|
121
|
+
if (!config.adminID.includes(session.userId)) {
|
|
122
122
|
return `[×] 您不是管理员,无权操作该指令...`;
|
|
123
123
|
}
|
|
124
124
|
if (!uid || !num) {
|
package/package.json
CHANGED
package/readme.md
CHANGED