mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
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:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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 }) => {
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user