fix: add action gate check and config type for createForumTopic

Address review feedback:
- Add isActionEnabled() gate in telegram-actions.ts
- Add gate() check in telegram adapter listActions
- Add createForumTopic to TelegramActionConfig type
This commit is contained in:
Claw
2026-02-15 10:32:46 +00:00
committed by Peter Steinberger
parent 68809ab80a
commit b007163057
3 changed files with 8 additions and 1 deletions

View File

@@ -341,6 +341,9 @@ export async function handleTelegramAction(
}
if (action === "createForumTopic") {
if (!isActionEnabled("createForumTopic")) {
throw new Error("Telegram createForumTopic is disabled.");
}
const chatId = readStringOrNumberParam(params, "chatId", {
required: true,
});

View File

@@ -69,7 +69,9 @@ export const telegramMessageActions: ChannelMessageActionAdapter = {
actions.add("sticker");
actions.add("sticker-search");
}
actions.add("topic-create");
if (gate("createForumTopic")) {
actions.add("topic-create");
}
return Array.from(actions);
},
supportsButtons: ({ cfg }) => {

View File

@@ -18,6 +18,8 @@ export type TelegramActionConfig = {
editMessage?: boolean;
/** Enable sticker actions (send and search). */
sticker?: boolean;
/** Enable forum topic creation. */
createForumTopic?: boolean;
};
export type TelegramNetworkConfig = {