@aka_openclaw_plugin/mychat 0.1.14 → 0.1.15
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/api.js +1 -1
- package/{channel-Cjn7oWbb.js → channel-CxT4NkH-.js} +13 -2
- package/channel-plugin-api.js +1 -1
- package/package.json +1 -1
- package/setup-entry.js +1 -1
package/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as tryGetMychatRuntime, i as setMychatRuntime, n as init_runtime, t as getMychatRuntime } from "./runtime-PfFuZ2Rm.js";
|
|
2
|
-
import { t as mychatPlugin } from "./channel-
|
|
2
|
+
import { t as mychatPlugin } from "./channel-CxT4NkH-.js";
|
|
3
3
|
//#region api.ts
|
|
4
4
|
init_runtime();
|
|
5
5
|
//#endregion
|
|
@@ -208,6 +208,9 @@ function createMychatHttpClient(params) {
|
|
|
208
208
|
return null;
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
|
+
async reportStatus(status) {
|
|
212
|
+
return await request("POST", "/api/bot/status", { status }) !== null;
|
|
213
|
+
},
|
|
211
214
|
async healthCheck() {
|
|
212
215
|
const url = `${base}/health`;
|
|
213
216
|
const start = Date.now();
|
|
@@ -4191,13 +4194,21 @@ async function monitorMychatProvider(ctx) {
|
|
|
4191
4194
|
lastError: null
|
|
4192
4195
|
});
|
|
4193
4196
|
logger?.info(`${prefix} bot connected botId=${readyBotSelf.botId}`);
|
|
4194
|
-
|
|
4197
|
+
try {
|
|
4198
|
+
await httpClient.reportStatus("online");
|
|
4199
|
+
logger?.info(`${prefix} reported status=online`);
|
|
4200
|
+
} catch (err) {
|
|
4201
|
+
logger?.warn(`${prefix} failed to report status: ${err}`);
|
|
4202
|
+
}
|
|
4203
|
+
ctx.abortSignal?.addEventListener("abort", async () => {
|
|
4195
4204
|
logger?.info(`${prefix} abort signal received, shutting down`);
|
|
4205
|
+
await httpClient.reportStatus("offline").catch(() => {});
|
|
4196
4206
|
lifecycle.shutdown();
|
|
4197
4207
|
setStatus({ connected: false });
|
|
4198
4208
|
});
|
|
4199
|
-
return { unsubscribe() {
|
|
4209
|
+
return { unsubscribe: async () => {
|
|
4200
4210
|
logger?.info(`${prefix} unsubscribe called, shutting down`);
|
|
4211
|
+
await httpClient.reportStatus("offline").catch(() => {});
|
|
4201
4212
|
lifecycle.shutdown();
|
|
4202
4213
|
setStatus({ connected: false });
|
|
4203
4214
|
} };
|
package/channel-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mychatPlugin } from "./channel-
|
|
1
|
+
import { t as mychatPlugin } from "./channel-CxT4NkH-.js";
|
|
2
2
|
export { mychatPlugin };
|
package/package.json
CHANGED
package/setup-entry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mychatPlugin } from "./channel-
|
|
1
|
+
import { t as mychatPlugin } from "./channel-CxT4NkH-.js";
|
|
2
2
|
export { mychatPlugin };
|