Add accountId and config support to Telegram webhook
The Telegram webhook and monitor now accept and pass through accountId and config parameters, enabling routing and configuration per Telegram account. Tests have been updated to verify correct bot instantiation and DM routing based on accountId bindings.
This commit is contained in:
committed by
Peter Steinberger
parent
ab993904d7
commit
ecb91bbb1a
@@ -1,6 +1,7 @@
|
||||
import { createServer } from "node:http";
|
||||
|
||||
import { webhookCallback } from "grammy";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import { formatErrorMessage } from "../infra/errors.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
@@ -8,6 +9,8 @@ import { createTelegramBot } from "./bot.js";
|
||||
|
||||
export async function startTelegramWebhook(opts: {
|
||||
token: string;
|
||||
accountId?: string;
|
||||
config?: ClawdbotConfig;
|
||||
path?: string;
|
||||
port?: number;
|
||||
host?: string;
|
||||
@@ -27,6 +30,8 @@ export async function startTelegramWebhook(opts: {
|
||||
token: opts.token,
|
||||
runtime,
|
||||
proxyFetch: opts.fetch,
|
||||
config: opts.config,
|
||||
accountId: opts.accountId,
|
||||
});
|
||||
const handler = webhookCallback(bot, "http", {
|
||||
secretToken: opts.secret,
|
||||
|
||||
Reference in New Issue
Block a user