koishi-plugin-dwrgbwiki 2.2.1 → 2.2.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/index.js +7 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -576,6 +576,9 @@ module.exports = {
|
|
|
576
576
|
|
|
577
577
|
ctx.command('反馈 <内容:text>', '反馈问题或建议(会私聊推送给管理员)')
|
|
578
578
|
.usage('反馈 <内容>')
|
|
579
|
+
.usage('反馈 <回复内容> -i <编号>(管理员:回复该反馈)')
|
|
580
|
+
.usage('反馈 拉黑 <用户id> [原因] / 反馈 拉黑 -i <编号> [原因](管理员:拉黑用户)')
|
|
581
|
+
.usage('反馈 解封 <用户id> / 反馈 黑名单(管理员)')
|
|
579
582
|
.example('反馈 抽卡图片显示异常')
|
|
580
583
|
.example('反馈 问题已处理 -i 12')
|
|
581
584
|
.check(async ({ session }) => {
|
|
@@ -583,7 +586,7 @@ module.exports = {
|
|
|
583
586
|
// (feedbackAdminIds 中配置的用户 id,或 koishi 权限 ≥2;koishi 新用户默认权限只有 1)
|
|
584
587
|
const body = session.content ? String(session.content).replace(/^反馈\s*/, '') : ''
|
|
585
588
|
const clean = body.trim()
|
|
586
|
-
const isAdminOp = /^(拉黑|解封|黑名单)
|
|
589
|
+
const isAdminOp = /^(拉黑|解封|黑名单)(?=\s|$)/.test(clean) || /\s+-i\s+\d+\s*$/.test(clean) || /^-i\s+\d+/.test(clean)
|
|
587
590
|
if (isAdminOp) {
|
|
588
591
|
const user = await session.observeUser(['authority']).catch(() => null)
|
|
589
592
|
const adminIds = Array.isArray(config.feedbackAdminIds) ? config.feedbackAdminIds : []
|
|
@@ -595,7 +598,7 @@ module.exports = {
|
|
|
595
598
|
const raw0 = session.content ? String(session.content).trim() : ''
|
|
596
599
|
const clean0 = raw0.replace(/^反馈\s*/, '').trim()
|
|
597
600
|
const isReply = /\s+-i\s+\d+\s*$/.test(clean0) || /^-i\s+\d+/.test(clean0)
|
|
598
|
-
const adminOp = (clean0.match(/^(拉黑|解封|黑名单)
|
|
601
|
+
const adminOp = (clean0.match(/^(拉黑|解封|黑名单)(?=\s|$)/) || [])[1] || ''
|
|
599
602
|
logCmd(ctx, session, '反馈' + (adminOp ? '(' + adminOp + ')' : (isReply ? '(回复)' : '')), { content })
|
|
600
603
|
// 从原始消息提取完整反馈文字(保留空格;text 类型会去掉空格)
|
|
601
604
|
const raw = session.content ? String(session.content).trim() : ''
|
|
@@ -609,7 +612,7 @@ module.exports = {
|
|
|
609
612
|
return '反馈黑名单(' + list.length + ' 人):\n' + lines.join('\n')
|
|
610
613
|
}
|
|
611
614
|
if (adminOp === '拉黑') {
|
|
612
|
-
const rest = clean0.replace(/^拉黑\
|
|
615
|
+
const rest = clean0.replace(/^拉黑\s*/, '').trim()
|
|
613
616
|
if (!rest) return '请指定要拉黑的用户,格式:反馈 拉黑 <用户id> [原因],或 反馈 拉黑 -i <反馈编号> [原因]'
|
|
614
617
|
let target = null
|
|
615
618
|
let reason = ''
|
|
@@ -637,7 +640,7 @@ module.exports = {
|
|
|
637
640
|
return '已将 ' + target.platform + '/' + target.userId + ' 加入反馈黑名单' + (reason ? '(原因:' + reason + ')' : '')
|
|
638
641
|
}
|
|
639
642
|
if (adminOp === '解封') {
|
|
640
|
-
const id = clean0.replace(/^解封\
|
|
643
|
+
const id = clean0.replace(/^解封\s*/, '').trim()
|
|
641
644
|
if (!id) return '请指定要解封的用户 id,格式:反馈 解封 <用户id>'
|
|
642
645
|
const ok = await feedbackStore.removeBlacklist(session.platform, id)
|
|
643
646
|
if (!ok) return '该用户不在反馈黑名单中'
|
package/package.json
CHANGED