mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-02 13:47:15 +00: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:
@@ -329,6 +329,9 @@ export async function handleTelegramAction(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action === "createForumTopic") {
|
if (action === "createForumTopic") {
|
||||||
|
if (!isActionEnabled("createForumTopic")) {
|
||||||
|
throw new Error("Telegram createForumTopic is disabled.");
|
||||||
|
}
|
||||||
const chatId = readStringOrNumberParam(params, "chatId", {
|
const chatId = readStringOrNumberParam(params, "chatId", {
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ export const telegramMessageActions: ChannelMessageActionAdapter = {
|
|||||||
actions.add("sticker");
|
actions.add("sticker");
|
||||||
actions.add("sticker-search");
|
actions.add("sticker-search");
|
||||||
}
|
}
|
||||||
|
if (gate("createForumTopic")) {
|
||||||
actions.add("topic-create");
|
actions.add("topic-create");
|
||||||
|
}
|
||||||
return Array.from(actions);
|
return Array.from(actions);
|
||||||
},
|
},
|
||||||
supportsButtons: ({ cfg }) => {
|
supportsButtons: ({ cfg }) => {
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ export type TelegramActionConfig = {
|
|||||||
editMessage?: boolean;
|
editMessage?: boolean;
|
||||||
/** Enable sticker actions (send and search). */
|
/** Enable sticker actions (send and search). */
|
||||||
sticker?: boolean;
|
sticker?: boolean;
|
||||||
|
/** Enable forum topic creation. */
|
||||||
|
createForumTopic?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TelegramNetworkConfig = {
|
export type TelegramNetworkConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user