MCPcopy Create free account
hub / github.com/AstrBotDevs/AstrBot / ensure_platform_webhook_config

Function ensure_platform_webhook_config

astrbot/core/utils/webhook_utils.py:69–82  ·  view source on GitHub ↗

为支持统一 webhook 的平台自动生成 webhook_uuid Args: platform_cfg (dict): 平台配置字典 Returns: bool: 如果生成了 webhook_uuid 则返回 True,否则返回 False

(platform_cfg: dict)

Source from the content-addressed store, hash-verified

67
68
69def ensure_platform_webhook_config(platform_cfg: dict) -> bool:
70 """为支持统一 webhook 的平台自动生成 webhook_uuid
71
72 Args:
73 platform_cfg (dict): 平台配置字典
74
75 Returns:
76 bool: 如果生成了 webhook_uuid 则返回 True,否则返回 False
77 """
78 pt = platform_cfg.get("type", "")
79 if pt in WEBHOOK_SUPPORTED_PLATFORMS and not platform_cfg.get("webhook_uuid"):
80 platform_cfg["webhook_uuid"] = uuid.uuid4().hex[:16]
81 return True
82 return False

Callers 3

initializeMethod · 0.90
create_botMethod · 0.90
update_botMethod · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected