UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.62 kB
import{c as normalizeOptionalLowercaseString,o as normalizeLowercaseStringOrEmpty}from"./string-coerce-CpTFcSwY.mjs";import"./string-coerce-runtime-BYDH9Quw.mjs";import{n as listTelegramAccountIds}from"./account-selection-CSIzQZif.mjs";import"./accounts-CHjEWHkL.mjs";import"./topic-conversation-C3o7-j7e.mjs";import{r as inspectTelegramAccount}from"./account-inspect-QgH_f1ZJ.mjs"; //!extensions/telegram/src/inline-buttons.ts const DEFAULT_INLINE_BUTTONS_SCOPE=`allowlist`;const INLINE_BUTTONS_SCOPES=[`off`,`dm`,`group`,`all`,`allowlist`];function resolveTelegramInlineButtonsConfigScope(e){if(!e||Array.isArray(e)||typeof e!==`object`||!(`inlineButtons`in e))return;const t=normalizeOptionalLowercaseString(e.inlineButtons);return INLINE_BUTTONS_SCOPES.find(e=>e===t)}function resolveTelegramInlineButtonsScopeFromCapabilities(e){if(Array.isArray(e)&&e.length>0)return e.some(e=>normalizeLowercaseStringOrEmpty(String(e))===`inlinebuttons`)?`all`:`off`;return resolveTelegramInlineButtonsConfigScope(e)??DEFAULT_INLINE_BUTTONS_SCOPE}function resolveTelegramInlineButtonsScope(e){return resolveTelegramInlineButtonsScopeFromCapabilities(inspectTelegramAccount({cfg:e.cfg,accountId:e.accountId}).config.capabilities)}function isTelegramInlineButtonsEnabled(e){const t=e.accountId?[e.accountId]:listTelegramAccountIds(e.cfg);return(t.length>0?t:[e.accountId]).some(t=>resolveTelegramInlineButtonsScope({cfg:e.cfg,accountId:t})!==`off`)}export{resolveTelegramInlineButtonsScopeFromCapabilities as i,resolveTelegramInlineButtonsConfigScope as n,resolveTelegramInlineButtonsScope as r,isTelegramInlineButtonsEnabled as t};