@napuketto/adapter 0.18.10 → 0.18.12
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/dist/{essence-BAjMzqQ_.mjs → essence-Cn1oRaLw.mjs} +2 -2
- package/dist/{essence-BAjMzqQ_.mjs.map → essence-Cn1oRaLw.mjs.map} +1 -1
- package/dist/{gray-tip-C_NzrsYf.mjs → gray-tip-BwsIxacB.mjs} +27 -17
- package/dist/gray-tip-BwsIxacB.mjs.map +1 -0
- package/dist/index.mjs +4 -4
- package/dist/kurobot/index.mjs +1 -1
- package/dist/{kurobot-DWMzq93a.mjs → kurobot-Gb0VmKZf.mjs} +2 -2
- package/dist/{kurobot-DWMzq93a.mjs.map → kurobot-Gb0VmKZf.mjs.map} +1 -1
- package/dist/milky/index.mjs +1 -1
- package/dist/{milky-BqEP4YO-.mjs → milky-BFYCfRx6.mjs} +9 -9
- package/dist/milky-BFYCfRx6.mjs.map +1 -0
- package/dist/onebot11/index.mjs +1 -1
- package/dist/{onebot11-DCnfgVdx.mjs → onebot11-ZYyghjp_.mjs} +21 -20
- package/dist/onebot11-ZYyghjp_.mjs.map +1 -0
- package/dist/{raw-message-D6QFcNXc.mjs → raw-message-DU8YOhLV.mjs} +6 -3
- package/dist/raw-message-DU8YOhLV.mjs.map +1 -0
- package/dist/satori/index.mjs +1 -1
- package/dist/{satori-BJf2c7B9.mjs → satori-C1RaFrGq.mjs} +17 -10
- package/dist/satori-C1RaFrGq.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/gray-tip-C_NzrsYf.mjs.map +0 -1
- package/dist/milky-BqEP4YO-.mjs.map +0 -1
- package/dist/onebot11-DCnfgVdx.mjs.map +0 -1
- package/dist/raw-message-D6QFcNXc.mjs.map +0 -1
- package/dist/satori-BJf2c7B9.mjs.map +0 -1
package/dist/onebot11/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { y as MessageUnique, t as NapukettoOneBot11Adapter, r as OneBotApi, n as assembleOb11Transports, a as canonicalToCqMessage, o as canonicalToSegments, s as cqMessageToCanonical, c as cqMessageToSegments, i as createOb11ActionRegistry, f as encodeCqCode, p as escapeCqParam, m as escapeCqText, u as ob11ConfigSchema, v as ob11ErrorCodeMap, h as parseCqMessage, l as segmentsToCanonical, d as segmentsToCqMessage, g as serializeCqParts, _ as unescapeCqText } from "../onebot11-
|
|
1
|
+
export { y as MessageUnique, t as NapukettoOneBot11Adapter, r as OneBotApi, n as assembleOb11Transports, a as canonicalToCqMessage, o as canonicalToSegments, s as cqMessageToCanonical, c as cqMessageToSegments, i as createOb11ActionRegistry, f as encodeCqCode, p as escapeCqParam, m as escapeCqText, u as ob11ConfigSchema, v as ob11ErrorCodeMap, h as parseCqMessage, l as segmentsToCanonical, d as segmentsToCqMessage, g as serializeCqParts, _ as unescapeCqText } from "../onebot11-ZYyghjp_.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as resolveProtocolConfig, i as BaseProtocolAdapter, l as ActionRegistry, o as BEARER_PREFIX, r as createServerSchema, s as createTokenAuthorize, u as runAction } from "./framework-Br7Tfx20.mjs";
|
|
2
|
-
import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, n as senderNickname, o as stringOrUndefined, r as subscribeRawMessages, s as startupBaselineSec, u as collectGroupNotifyUids } from "./raw-message-
|
|
3
|
-
import { a as logEventFailure, c as downloadBufferToFile, d as prepareVideoElements, i as hasGrayTip, l as ensureSilk, o as sliceRaw, r as firstUntranslatedGrayTip, s as truncRaw, t as collectGrayTipUids, u as fileUriToPath } from "./gray-tip-
|
|
4
|
-
import { a as processSysMsgBlob, d as processInboundBuddyReqs, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-
|
|
2
|
+
import { a as firstNonEmptyString, c as MS_TO_SEC, d as numericUin, f as resolveUidToUinWithFallback, i as toUnixSeconds, l as NUMERIC_RE, m as toUin, n as senderNickname, o as stringOrUndefined, r as subscribeRawMessages, s as startupBaselineSec, u as collectGroupNotifyUids } from "./raw-message-DU8YOhLV.mjs";
|
|
3
|
+
import { a as logEventFailure, c as downloadBufferToFile, d as prepareVideoElements, i as hasGrayTip, l as ensureSilk, o as sliceRaw, r as firstUntranslatedGrayTip, s as truncRaw, t as collectGrayTipUids, u as fileUriToPath } from "./gray-tip-BwsIxacB.mjs";
|
|
4
|
+
import { a as processSysMsgBlob, d as processInboundBuddyReqs, n as OBSERVED_UNNAMED_SYSMSG_KEYS, o as recognizeSysMsg, r as narrowSysMsgBlobs, t as extractEssenceSetSysMsg, u as BuddyReqDedup } from "./essence-Cn1oRaLw.mjs";
|
|
5
5
|
import { ChatType, EssenceListSync, GrayTipSubType, GroupApi, GroupNotifyMsgStatus, GroupNotifyMsgType, NTGroupMemberRole, NTGroupRequestOperateTypes, TicketApi, TipGroupElementType, WebHonorType, errorMessage, hasStringProp, isRecord, kernelError, narrowEssenceGroupArg, toCanonicalElements } from "@napuketto/kernel";
|
|
6
6
|
import { HttpClient, HttpServer, WsClient, WsServer } from "@napuketto/network";
|
|
7
7
|
import { z } from "zod";
|
|
@@ -1594,7 +1594,7 @@ function toOb11MessageInfo(msg, unique, ctx = {}) {
|
|
|
1594
1594
|
info.group_id = Number(msg.peerUid);
|
|
1595
1595
|
const { sender } = info;
|
|
1596
1596
|
sender.role = ctx.senderRole ?? "member";
|
|
1597
|
-
if (msg.sendMemberName
|
|
1597
|
+
if (msg.sendMemberName != null) sender.card = msg.sendMemberName;
|
|
1598
1598
|
} else info.user_id = Number(msg.senderUin);
|
|
1599
1599
|
return info;
|
|
1600
1600
|
}
|
|
@@ -1676,7 +1676,7 @@ const GROUP_CHANGE_BUILDERS = {
|
|
|
1676
1676
|
/** 群成员变动(group_increase / group_decrease / group_admin / group_ban)。 */
|
|
1677
1677
|
function toGroupChange(msg, g, ctx) {
|
|
1678
1678
|
const grp = g?.groupElement;
|
|
1679
|
-
if (grp == null || grp.type
|
|
1679
|
+
if (grp == null || grp.type == null) return null;
|
|
1680
1680
|
const builder = GROUP_CHANGE_BUILDERS[grp.type];
|
|
1681
1681
|
if (builder === void 0) return null;
|
|
1682
1682
|
return builder({
|
|
@@ -1767,7 +1767,7 @@ function toFriendAdd(entry, selfUin) {
|
|
|
1767
1767
|
*/
|
|
1768
1768
|
function toGroupUpload(msg, selfUin) {
|
|
1769
1769
|
const file = msg.elements.find((e) => e.fileElement != null)?.fileElement;
|
|
1770
|
-
if (file
|
|
1770
|
+
if (file == null) return null;
|
|
1771
1771
|
return {
|
|
1772
1772
|
time: toUnixSeconds(msg.msgTime),
|
|
1773
1773
|
self_id: Number(selfUin),
|
|
@@ -2195,11 +2195,11 @@ function extractPicElement(el, deps) {
|
|
|
2195
2195
|
const pic = el.picElement;
|
|
2196
2196
|
if (pic == null) return;
|
|
2197
2197
|
const out = {};
|
|
2198
|
-
if (pic.fileSize
|
|
2199
|
-
if (pic.fileName
|
|
2200
|
-
if (pic.picUrl
|
|
2198
|
+
if (pic.fileSize != null) out.file_size = pic.fileSize;
|
|
2199
|
+
if (pic.fileName != null) out.file_name = pic.fileName;
|
|
2200
|
+
if (pic.picUrl != null) out.url = pic.picUrl;
|
|
2201
2201
|
const rel = pic.sourcePath ?? pic.picPath;
|
|
2202
|
-
if (rel
|
|
2202
|
+
if (rel != null) {
|
|
2203
2203
|
const local = resolveLocalMediaFile(rel, deps);
|
|
2204
2204
|
if (local !== null) out.file = local;
|
|
2205
2205
|
}
|
|
@@ -2210,11 +2210,11 @@ async function downloadPttFallback(msgId, peer, id, deps) {
|
|
|
2210
2210
|
try {
|
|
2211
2211
|
const downloaded = await deps.msgApi.downloadPtt(msgId, peer);
|
|
2212
2212
|
const rel = downloaded.filePath;
|
|
2213
|
-
if (rel
|
|
2213
|
+
if (rel != null && rel !== "") {
|
|
2214
2214
|
const localAfter = resolveLocalMediaFile(rel, deps);
|
|
2215
2215
|
if (localAfter !== null) return {
|
|
2216
|
-
...downloaded.fileSize
|
|
2217
|
-
...downloaded.fileName
|
|
2216
|
+
...downloaded.fileSize != null ? { file_size: downloaded.fileSize } : {},
|
|
2217
|
+
...downloaded.fileName != null ? { file_name: downloaded.fileName } : {},
|
|
2218
2218
|
file: localAfter
|
|
2219
2219
|
};
|
|
2220
2220
|
}
|
|
@@ -2250,19 +2250,20 @@ function createMediaActions(api) {
|
|
|
2250
2250
|
const [first] = await api.msgApi.fetchMsgsByMsgId(peer, [msgId]);
|
|
2251
2251
|
if (first === void 0) throw kernelError(`消息 ${id} 不存在或已被撤回`, "NOT_FOUND");
|
|
2252
2252
|
const ptt = first.elements.find((e) => e.pttElement != null)?.pttElement;
|
|
2253
|
-
|
|
2253
|
+
const filePath = ptt?.filePath;
|
|
2254
|
+
if (ptt == null || filePath == null) throw kernelError(`消息 ${id} 不包含语音`, "NOT_FOUND");
|
|
2254
2255
|
const meta = () => ({
|
|
2255
|
-
...ptt.fileSize
|
|
2256
|
-
...ptt.fileName
|
|
2256
|
+
...ptt.fileSize != null ? { file_size: ptt.fileSize } : {},
|
|
2257
|
+
...ptt.fileName != null ? { file_name: ptt.fileName } : {}
|
|
2257
2258
|
});
|
|
2258
|
-
const local = resolveLocalMediaFile(
|
|
2259
|
+
const local = resolveLocalMediaFile(filePath, api);
|
|
2259
2260
|
if (local !== null) return {
|
|
2260
2261
|
...meta(),
|
|
2261
2262
|
file: local
|
|
2262
2263
|
};
|
|
2263
2264
|
return await downloadPttFallback(msgId, peer, id, api) ?? {
|
|
2264
2265
|
...meta(),
|
|
2265
|
-
file:
|
|
2266
|
+
file: filePath
|
|
2266
2267
|
};
|
|
2267
2268
|
}
|
|
2268
2269
|
}),
|
|
@@ -3438,7 +3439,7 @@ function toOb11MessageEvent(msg, selfUin, unique, messageFormat = "array", ctx =
|
|
|
3438
3439
|
nickname: senderNickname(msg),
|
|
3439
3440
|
role: ctx.senderRole ?? "member"
|
|
3440
3441
|
};
|
|
3441
|
-
if (msg.sendMemberName
|
|
3442
|
+
if (msg.sendMemberName != null) sender.card = msg.sendMemberName;
|
|
3442
3443
|
return {
|
|
3443
3444
|
...base,
|
|
3444
3445
|
message_type: "group",
|
|
@@ -4069,4 +4070,4 @@ function echoFieldOf(req) {
|
|
|
4069
4070
|
}
|
|
4070
4071
|
export { unescapeCqText as _, canonicalToCqMessage as a, cqMessageToSegments as c, segmentsToCqMessage as d, encodeCqCode as f, serializeCqParts as g, parseCqMessage as h, createOb11ActionRegistry as i, segmentsToCanonical as l, escapeCqText as m, assembleOb11Transports as n, canonicalToSegments as o, escapeCqParam as p, OneBotApi as r, cqMessageToCanonical as s, NapukettoOneBot11Adapter as t, ob11ConfigSchema as u, ob11ErrorCodeMap as v, MessageUnique as y };
|
|
4071
4072
|
|
|
4072
|
-
//# sourceMappingURL=onebot11-
|
|
4073
|
+
//# sourceMappingURL=onebot11-ZYyghjp_.mjs.map
|