koishi-plugin-ll-brick 1.0.8 → 1.0.9
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 -0
- package/lib/index.js +18 -15
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -37,6 +37,9 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
37
37
|
adminUsers: koishi_1.Schema.array(koishi_1.Schema.string())
|
|
38
38
|
.default([])
|
|
39
39
|
.description('管理员 ID 列表(openid):被加入的 ID 可以使用「充值」等管理命令'),
|
|
40
|
+
slapImage: koishi_1.Schema.string()
|
|
41
|
+
.default('https://img3.tofaka.com/autoupload/ontjZmlK09ZHnuFOv9znC7KXl_QqVl-bpSwqP4fJO68/20260624/lOIl/240X240/images.jpg')
|
|
42
|
+
.description('「拍人」消息顶部图片 URL(需公网可访问;留空则不显示图片)'),
|
|
40
43
|
}),
|
|
41
44
|
koishi_1.Schema.object({
|
|
42
45
|
checking: koishi_1.Schema.boolean()
|
|
@@ -79,19 +82,23 @@ function stripMarkdown(md) {
|
|
|
79
82
|
function mdCard(lines) {
|
|
80
83
|
return lines.filter(Boolean).join('\n');
|
|
81
84
|
}
|
|
82
|
-
async function sendQQMarkdown(session, text) {
|
|
85
|
+
async function sendQQMarkdown(session, text, imageUrl, imageSize) {
|
|
83
86
|
const channelId = session.guildId;
|
|
84
87
|
const internal = session.bot?.internal;
|
|
85
88
|
if (!channelId || !internal || typeof internal.sendMessage !== 'function') {
|
|
86
89
|
return false;
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
// 顶部图片:QQ markdown 图片必须带尺寸参数,且需公网可访问 URL
|
|
92
|
+
const md = imageUrl
|
|
93
|
+
? `\n\n${text}`
|
|
94
|
+
: text;
|
|
95
|
+
const plain = stripMarkdown(md) || ' ';
|
|
89
96
|
try {
|
|
90
97
|
await internal.sendMessage(channelId, {
|
|
91
98
|
msg_type: 2,
|
|
92
99
|
msg_seq: 0,
|
|
93
100
|
content: plain,
|
|
94
|
-
markdown: { content:
|
|
101
|
+
markdown: { content: md },
|
|
95
102
|
});
|
|
96
103
|
return true;
|
|
97
104
|
}
|
|
@@ -239,14 +246,12 @@ async function apply(ctx, config) {
|
|
|
239
246
|
if (koishi_1.Random.bool(probability)) {
|
|
240
247
|
const muteErr = await tryMute(session.userId);
|
|
241
248
|
const msg = mdCard([
|
|
242
|
-
|
|
243
|
-
'
|
|
244
|
-
'
|
|
245
|
-
`> 🎯 ${atUser(session, targetUserId)} 夺过你的砖头,把你拍晕了 **${muteTime}** 秒 🏏`,
|
|
246
|
-
muteErr ? '> ⚠️ 因为我不是群管理员,所以并没什么卵用' : '',
|
|
249
|
+
`${atUser(session, targetUserId)} 夺过你的砖头,把你拍晕了 **${muteTime}** 秒 🏏`,
|
|
250
|
+
'⚠️ 危险警告:有人动用了板砖!',
|
|
251
|
+
muteErr ? '(因为我不是群管理员,所以并没什么卵用)' : '',
|
|
247
252
|
]);
|
|
248
253
|
if (isQQ) {
|
|
249
|
-
await sendQQMarkdown(session, msg);
|
|
254
|
+
await sendQQMarkdown(session, msg, config.slapImage);
|
|
250
255
|
return;
|
|
251
256
|
}
|
|
252
257
|
return msg;
|
|
@@ -254,14 +259,12 @@ async function apply(ctx, config) {
|
|
|
254
259
|
else {
|
|
255
260
|
const muteErr = await tryMute(targetUserId);
|
|
256
261
|
const msg = mdCard([
|
|
257
|
-
|
|
258
|
-
'
|
|
259
|
-
'
|
|
260
|
-
`> 🎯 ${atUser(session, targetUserId)} 你被 ${atUser(session, session.userId)} 一砖头拍晕了 **${muteTime}** 秒 🏏`,
|
|
261
|
-
muteErr ? '> ⚠️ 因为我不是群管理员,所以并没什么卵用' : '',
|
|
262
|
+
`${atUser(session, targetUserId)} 你被 ${atUser(session, session.userId)} 一砖头拍晕了 **${muteTime}** 秒 🏏`,
|
|
263
|
+
'⚠️ 危险警告:有人动用了板砖!',
|
|
264
|
+
muteErr ? '(因为我不是群管理员,所以并没什么卵用)' : '',
|
|
262
265
|
]);
|
|
263
266
|
if (isQQ) {
|
|
264
|
-
await sendQQMarkdown(session, msg);
|
|
267
|
+
await sendQQMarkdown(session, msg, config.slapImage);
|
|
265
268
|
return;
|
|
266
269
|
}
|
|
267
270
|
return msg;
|