mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 17:10:20 +00:00
Telegram: improve webhook config guidance and startup fallback
This commit is contained in:
@@ -207,6 +207,7 @@ describe("startTelegramWebhook", () => {
|
||||
initSpy.mockClear();
|
||||
createTelegramBotSpy.mockClear();
|
||||
webhookCallbackSpy.mockClear();
|
||||
const runtimeLog = vi.fn();
|
||||
const abort = new AbortController();
|
||||
const cfg = { bindings: [] };
|
||||
const { server } = await startTelegramWebhook({
|
||||
@@ -216,6 +217,7 @@ describe("startTelegramWebhook", () => {
|
||||
config: cfg,
|
||||
port: 0, // random free port
|
||||
abortSignal: abort.signal,
|
||||
runtime: { log: runtimeLog, error: vi.fn(), exit: vi.fn() },
|
||||
});
|
||||
expect(createTelegramBotSpy).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
@@ -246,6 +248,13 @@ describe("startTelegramWebhook", () => {
|
||||
timeoutMilliseconds: 10_000,
|
||||
},
|
||||
);
|
||||
expect(runtimeLog).toHaveBeenCalledWith(
|
||||
expect.stringContaining("webhook local listener on http://127.0.0.1:"),
|
||||
);
|
||||
expect(runtimeLog).toHaveBeenCalledWith(expect.stringContaining("/telegram-webhook"));
|
||||
expect(runtimeLog).toHaveBeenCalledWith(
|
||||
expect.stringContaining("webhook advertised to telegram on http://"),
|
||||
);
|
||||
|
||||
abort.abort();
|
||||
});
|
||||
|
||||
@@ -250,7 +250,8 @@ export async function startTelegramWebhook(opts: {
|
||||
throw err;
|
||||
}
|
||||
|
||||
runtime.log?.(`webhook listening on ${publicUrl}`);
|
||||
runtime.log?.(`webhook local listener on http://${host}:${port}${path}`);
|
||||
runtime.log?.(`webhook advertised to telegram on ${publicUrl}`);
|
||||
|
||||
let shutDown = false;
|
||||
const shutdown = () => {
|
||||
|
||||
Reference in New Issue
Block a user