新增BlueBubbles适配器全套核心工具类与服务,包含会话管理、消息去重、Webhook验证、缓存系统、账号配置解析、聊天消息处理等完整功能模块,支持iMessage消息收发、群管理、反应特效、语音合成等能力,提供完善的健康检查与配置校验流程。
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
from yuxi.channels.exceptions import ChannelException
|
|
|
|
|
|
class BlueBubblesError(ChannelException):
|
|
def __init__(self, message: str, retryable: bool = False, retry_after_ms: int = 0):
|
|
super().__init__(message, retryable=retryable, retry_after_ms=retry_after_ms)
|
|
|
|
|
|
class BlueBubblesHTTPError(BlueBubblesError):
|
|
def __init__(self, status_code: int, message: str = "", headers: dict | None = None):
|
|
self.status_code = status_code
|
|
self.headers = headers or {}
|
|
retryable = status_code >= 500 or status_code == 429
|
|
detail = f"HTTP {status_code}: {message}" if message else f"HTTP {status_code}"
|
|
super().__init__(detail, retryable=retryable)
|
|
|
|
|
|
class BlueBubblesConnectionError(BlueBubblesError):
|
|
def __init__(self, message: str = ""):
|
|
super().__init__(message or "BlueBubbles connection failed", retryable=True, retry_after_ms=5000)
|
|
|
|
|
|
class BlueBubblesAuthenticationError(BlueBubblesError):
|
|
def __init__(self, message: str = ""):
|
|
super().__init__(message or "BlueBubbles authentication failed", retryable=False)
|
|
|
|
|
|
class TapbackError(BlueBubblesError):
|
|
def __init__(self, message: str = ""):
|
|
super().__init__(message or "Tapback operation failed", retryable=False)
|