koishi-plugin-cs2-server-query 1.4.0 → 1.4.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.js +5 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -635,12 +635,13 @@ ${mapList}
|
|
|
635
635
|
return `您当前订阅的地图列表:
|
|
636
636
|
${subscriptionList}`;
|
|
637
637
|
});
|
|
638
|
-
async function sendMessageToTarget(ctx2, targetId, pushType, message) {
|
|
638
|
+
async function sendMessageToTarget(ctx2, targetId, pushType, message, userId) {
|
|
639
639
|
try {
|
|
640
640
|
if (pushType === "私聊") {
|
|
641
641
|
await ctx2.bots[0].sendPrivateMessage(targetId, message);
|
|
642
642
|
} else {
|
|
643
|
-
|
|
643
|
+
const atMessage = userId ? import_koishi.h.at(userId) + " " + message : message;
|
|
644
|
+
await ctx2.bots[0].sendMessage(targetId, atMessage);
|
|
644
645
|
}
|
|
645
646
|
} catch (err) {
|
|
646
647
|
ctx2.logger("cs2-server-query").error(`发送消息失败: ${err.message}`);
|
|
@@ -693,8 +694,8 @@ ${subscriptionList}`;
|
|
|
693
694
|
const imageBuffer = await generatePushImage(server, mapTranslations);
|
|
694
695
|
const message = `connect ${server.ip}`;
|
|
695
696
|
const targetId = sub.pushType === "私聊" ? sub.userId : sub.channelId;
|
|
696
|
-
await sendMessageToTarget(ctx, targetId, sub.pushType, import_koishi.h.image(imageBuffer, "image/png"));
|
|
697
|
-
await sendMessageToTarget(ctx, targetId, sub.pushType, message);
|
|
697
|
+
await sendMessageToTarget(ctx, targetId, sub.pushType, import_koishi.h.image(imageBuffer, "image/png"), sub.userId);
|
|
698
|
+
await sendMessageToTarget(ctx, targetId, sub.pushType, message, sub.userId);
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
701
|
}
|