fix(telegram): wire webhookPort through config and startup

Co-authored-by: xrf9268-hue <244283935+xrf9268-hue@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-22 17:49:59 +01:00
parent 5069250faf
commit d0e6763263
6 changed files with 78 additions and 0 deletions

View File

@@ -122,4 +122,44 @@ describe("telegramPlugin duplicate token guard", () => {
expect(probeTelegram).not.toHaveBeenCalled();
expect(monitorTelegramProvider).not.toHaveBeenCalled();
});
it("passes webhookPort through to monitor startup options", async () => {
const monitorTelegramProvider = vi.fn(async () => undefined);
const probeTelegram = vi.fn(async () => ({ ok: true, bot: { username: "opsbot" } }));
const runtime = {
channel: {
telegram: {
monitorTelegramProvider,
probeTelegram,
},
},
logging: {
shouldLogVerbose: () => false,
},
} as unknown as PluginRuntime;
setTelegramRuntime(runtime);
const cfg = createCfg();
cfg.channels!.telegram!.accounts!.ops = {
...cfg.channels!.telegram!.accounts!.ops,
webhookUrl: "https://example.test/telegram-webhook",
webhookSecret: "secret",
webhookPort: 9876,
};
await telegramPlugin.gateway!.startAccount!(
createStartAccountCtx({
cfg,
accountId: "ops",
runtime: createRuntimeEnv(),
}),
);
expect(monitorTelegramProvider).toHaveBeenCalledWith(
expect.objectContaining({
useWebhook: true,
webhookPort: 9876,
}),
);
});
});

View File

@@ -492,6 +492,7 @@ export const telegramPlugin: ChannelPlugin<ResolvedTelegramAccount, TelegramProb
webhookSecret: account.config.webhookSecret,
webhookPath: account.config.webhookPath,
webhookHost: account.config.webhookHost,
webhookPort: account.config.webhookPort,
});
},
logoutAccount: async ({ accountId, cfg }) => {