@dcrays/dcgchat 0.2.8 → 0.2.10
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/package.json +1 -1
- package/src/bot.ts +4 -4
- package/src/channel.ts +8 -8
- package/src/request.ts +1 -1
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -131,7 +131,7 @@ export async function handleDcgchatMessage(params: {
|
|
|
131
131
|
|
|
132
132
|
const route = core.channel.routing.resolveAgentRoute({
|
|
133
133
|
cfg,
|
|
134
|
-
channel: "dcgchat
|
|
134
|
+
channel: "dcgchat",
|
|
135
135
|
accountId: account.accountId,
|
|
136
136
|
peer: { kind: "direct", id: userId },
|
|
137
137
|
});
|
|
@@ -168,13 +168,13 @@ export async function handleDcgchatMessage(params: {
|
|
|
168
168
|
ChatType: "direct",
|
|
169
169
|
SenderName: userId,
|
|
170
170
|
SenderId: userId,
|
|
171
|
-
Provider: "dcgchat
|
|
172
|
-
Surface: "dcgchat
|
|
171
|
+
Provider: "dcgchat" as const,
|
|
172
|
+
Surface: "dcgchat" as const,
|
|
173
173
|
MessageSid: msg.content.message_id,
|
|
174
174
|
Timestamp: Date.now(),
|
|
175
175
|
WasMentioned: true,
|
|
176
176
|
CommandAuthorized: true,
|
|
177
|
-
OriginatingChannel: "dcgchat
|
|
177
|
+
OriginatingChannel: "dcgchat" as const,
|
|
178
178
|
OriginatingTo: `user:${userId}`,
|
|
179
179
|
...mediaPayload,
|
|
180
180
|
});
|
package/src/channel.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { getMsgParams } from "./tool.js";
|
|
|
8
8
|
|
|
9
9
|
export function resolveAccount(cfg: OpenClawConfig, accountId?: string | null): ResolvedDcgchatAccount {
|
|
10
10
|
const id = accountId ?? DEFAULT_ACCOUNT_ID;
|
|
11
|
-
const raw = (cfg.channels?.["dcgchat
|
|
11
|
+
const raw = (cfg.channels?.["dcgchat"] as DcgchatConfig | undefined) ?? {};
|
|
12
12
|
return {
|
|
13
13
|
accountId: id,
|
|
14
14
|
enabled: raw.enabled !== false,
|
|
@@ -22,13 +22,13 @@ export function resolveAccount(cfg: OpenClawConfig, accountId?: string | null):
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
25
|
-
id: "dcgchat
|
|
25
|
+
id: "dcgchat",
|
|
26
26
|
meta: {
|
|
27
|
-
id: "dcgchat
|
|
27
|
+
id: "dcgchat",
|
|
28
28
|
label: "书灵墨宝",
|
|
29
29
|
selectionLabel: "书灵墨宝",
|
|
30
30
|
docsPath: "/channels/dcgchat",
|
|
31
|
-
docsLabel: "dcgchat
|
|
31
|
+
docsLabel: "dcgchat",
|
|
32
32
|
blurb: "连接 OpenClaw 与 书灵墨宝 产品",
|
|
33
33
|
order: 80,
|
|
34
34
|
},
|
|
@@ -68,8 +68,8 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
68
68
|
...cfg,
|
|
69
69
|
channels: {
|
|
70
70
|
...cfg.channels,
|
|
71
|
-
"dcgchat
|
|
72
|
-
...(cfg.channels?.["dcgchat
|
|
71
|
+
"dcgchat": {
|
|
72
|
+
...(cfg.channels?.["dcgchat"] as Record<string, unknown> | undefined),
|
|
73
73
|
enabled,
|
|
74
74
|
},
|
|
75
75
|
},
|
|
@@ -140,7 +140,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
140
140
|
log(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
|
|
141
141
|
}
|
|
142
142
|
return {
|
|
143
|
-
channel: "dcgchat
|
|
143
|
+
channel: "dcgchat",
|
|
144
144
|
messageId: `dcg-${Date.now()}`,
|
|
145
145
|
chatId: params.userId.toString(),
|
|
146
146
|
};
|
|
@@ -218,7 +218,7 @@ export const dcgchatPlugin: ChannelPlugin<ResolvedDcgchatAccount> = {
|
|
|
218
218
|
log(`[dcgchat][${ctx.accountId ?? DEFAULT_ACCOUNT_ID}] outbound -> ${ws?.readyState}: ${ctx.text}`);
|
|
219
219
|
}
|
|
220
220
|
return {
|
|
221
|
-
channel: "dcgchat
|
|
221
|
+
channel: "dcgchat",
|
|
222
222
|
messageId: `dcg-${Date.now()}`,
|
|
223
223
|
chatId: params.userId.toString(),
|
|
224
224
|
};
|