koishi-plugin-dwrgbwiki 2.0.2 → 2.0.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.
Files changed (2) hide show
  1. package/index.js +22 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -609,7 +609,21 @@ module.exports = {
609
609
  const replyText = optMatch ? body.replace(/\s+-i\s+\d+\s*$/, '').trim() : (content ? String(content).trim() : '')
610
610
  if (!replyText) return '请附上要回复给反馈者的内容,格式:反馈 <回复内容> -i <编号>'
611
611
  const bot = ctx.bots && ctx.bots.find(b => b.platform === record.platform && b.status === 1)
612
- if (!bot) return '反馈者所在平台没有可用的机器人,无法回复'
612
+ if (!bot) {
613
+ ctx.logger('dwrgbwiki').warn('回复反馈: 未找到可用机器人 | 目标=' + record.platform + ' | bots=' + JSON.stringify((ctx.bots || []).map(b => ({ p: b.platform, s: b.status, id: b.selfId || b.sid }))))
614
+ return '反馈者所在平台没有可用的机器人,无法回复'
615
+ }
616
+ // 优先回复到原发起反馈的群聊(channelId 是群消息端点用的 id),其次私聊反馈者
617
+ const targetChannel = record.channelId || record.guildId
618
+ if (targetChannel) {
619
+ try {
620
+ await bot.sendMessage(targetChannel, '【回复 #' + replyId + '】' + replyText + '\n(回复 ' + record.userId + ' 的反馈:' + String(record.content || '').slice(0, 50) + ')')
621
+ await feedbackStore.markReplied(replyId)
622
+ return '已回复编号 ' + replyId + '(已发到原反馈群)'
623
+ } catch (e) {
624
+ ctx.logger('dwrgbwiki').warn('回复反馈到原群失败,尝试私聊: ' + (e && e.message ? e.message : e) + ' | channelId=' + record.channelId + ' guildId=' + record.guildId + ' | stack: ' + (e && e.stack ? String(e.stack).slice(0, 200) : ''))
625
+ }
626
+ }
613
627
  try {
614
628
  await bot.sendPrivateMessage(record.userId, '【回复】' + replyText)
615
629
  await feedbackStore.markReplied(replyId)
@@ -641,6 +655,8 @@ module.exports = {
641
655
  senderName,
642
656
  platform: session.platform,
643
657
  userId: session.userId,
658
+ channelId: session.channelId || '',
659
+ guildId: session.guildId || '',
644
660
  time,
645
661
  })
646
662
  const feedbackMsg = '【反馈 #' + record.id + '】' + text + '\n反馈人:' + senderName + '\n来源:' + session.platform + '\n账号:' + session.userId + '\n时间:' + time + '\n回复:发送「反馈 <内容> -i ' + record.id + '」'
@@ -648,6 +664,9 @@ module.exports = {
648
664
  const hasTarget = (config.feedbackPlatform && (config.feedbackChannelId || config.feedbackUserId))
649
665
  if (hasTarget) {
650
666
  const bot = ctx.bots && ctx.bots.find(b => b.platform === config.feedbackPlatform && b.status === 1)
667
+ if (!bot) {
668
+ ctx.logger('dwrgbwiki').warn('反馈推送: 未找到可用机器人 | 目标=' + config.feedbackPlatform + ' | bots=' + JSON.stringify((ctx.bots || []).map(b => ({ p: b.platform, s: b.status, id: b.selfId || b.sid }))))
669
+ }
651
670
  if (bot) {
652
671
  try {
653
672
  if (config.feedbackChannelId) {
@@ -655,7 +674,7 @@ module.exports = {
655
674
  } else {
656
675
  await bot.sendPrivateMessage(config.feedbackUserId, feedbackMsg)
657
676
  }
658
- return '已收到反馈(编号 #' + record.id + ')'
677
+ return '已收到反馈(编号 #' + record.id + '),如果想收到回复请联系本群群主打开允许机器人主动回复消息功能'
659
678
  } catch (e) {
660
679
  ctx.logger('dwrgbwiki').warn('反馈推送失败: ' + (e && e.message ? e.message : e) + ' | stack: ' + (e && e.stack ? String(e.stack).slice(0, 300) : '') + ' | target: ' + config.feedbackPlatform + '/' + (config.feedbackChannelId || config.feedbackUserId) + ' | bot: ' + (bot.platform || '?') + ':' + (bot.selfId || bot.sid) + ' status=' + bot.status)
661
680
  return '已收到反馈(编号 #' + record.id + ',但推送给管理员失败,请稍后重试)'
@@ -663,7 +682,7 @@ module.exports = {
663
682
  }
664
683
  return '已收到反馈(编号 #' + record.id + ',但未找到可用的推送机器人,请稍后重试)'
665
684
  }
666
- return '已收到反馈(编号 #' + record.id + ')'
685
+ return '已收到反馈(编号 #' + record.id + '),如果想收到回复请联系本群群主打开允许机器人主动回复消息功能'
667
686
  })
668
687
  },
669
688
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-dwrgbwiki",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "第五人格BWIKI编辑组开发,所有代码由DeepSeek V4 Flash 0731编写。支持胜率/地图/模仿者/勋章/基础数据查询、图鉴查询、wiki页面截图、藏头诗、抽卡模拟、加页手记探索、赛事数据(选手/对决)、公告变动推送、反馈系统等功能。",
5
5
  "main": "index.js",
6
6
  "files": [