koishi-plugin-cat-raising 0.1.0 → 0.1.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.js +13 -4
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -134,7 +134,6 @@ function apply(ctx, config) {
|
|
|
134
134
|
}
|
|
135
135
|
const roomIds = extractAllRoomIds(messageForChecks);
|
|
136
136
|
if (roomIds.length > 1) {
|
|
137
|
-
session.send(`检测到多个直播间号 (${roomIds.join(", ")}),为避免信息混淆,已停止处理。`);
|
|
138
137
|
return;
|
|
139
138
|
}
|
|
140
139
|
const roomId = roomIds.length === 1 ? roomIds[0] : null;
|
|
@@ -142,8 +141,15 @@ function apply(ctx, config) {
|
|
|
142
141
|
if (!parsedEvents || !roomId) {
|
|
143
142
|
return;
|
|
144
143
|
}
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
const strongContextRegex = /神金|发|掉落|猫猫钻|w/i;
|
|
145
|
+
const hasStrongContext = strongContextRegex.test(messageForChecks);
|
|
146
|
+
const hasTime = parsedEvents.some((event) => event.dateTime !== "时间未知");
|
|
147
|
+
if (!hasStrongContext && !hasTime) {
|
|
148
|
+
ctx.logger.info(`纯数字信息缺少时间,已忽略: ${messageForChecks.replace(/\s+/g, " ").substring(0, 50)}...`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (forwardedHistory.some((entry) => entry.roomId === roomId)) {
|
|
152
|
+
session.send(`看到啦看到啦,不要发那么多次嘛~`);
|
|
147
153
|
return;
|
|
148
154
|
}
|
|
149
155
|
let biliInfo = "";
|
|
@@ -168,6 +174,7 @@ function apply(ctx, config) {
|
|
|
168
174
|
}
|
|
169
175
|
} catch (error) {
|
|
170
176
|
ctx.logger.warn(`获取直播间 ${roomId} 的B站信息失败: ${error.message}`);
|
|
177
|
+
return;
|
|
171
178
|
}
|
|
172
179
|
const forwardMessage = originalMessageContent + biliInfo;
|
|
173
180
|
try {
|
|
@@ -182,7 +189,9 @@ function apply(ctx, config) {
|
|
|
182
189
|
const newEntry = {
|
|
183
190
|
originalMessageId: messageId,
|
|
184
191
|
forwardedMessageId,
|
|
185
|
-
originalContent: originalMessageContent
|
|
192
|
+
originalContent: originalMessageContent,
|
|
193
|
+
roomId
|
|
194
|
+
// 新增
|
|
186
195
|
};
|
|
187
196
|
forwardedHistory.push(newEntry);
|
|
188
197
|
if (forwardedHistory.length > HISTORY_SIZE) {
|