ForcePilot/backend/package/yuxi/channels/adapters/twitch/token_utils.py
Kris 59cd13cf84 feat(twitch): 实现完整的Twitch聊天适配器模块
新增Twitch IRC协议相关的全套实现,包括:
1. 基础工具类:令牌处理、消息格式化、速率限制、消息去重
2. 核心适配器组件:IRC解析器、消息归一化、外发消息处理
3. API客户端:Helix API封装、认证提供者
4. 配置与部署:配置校验、设置向导
5. 辅助功能:配对管理、健康检查、目标解析等
2026-05-12 00:50:10 +08:00

13 lines
271 B
Python

from __future__ import annotations
def ensure_oauth_prefix(token: str) -> str:
token = token.strip()
if token.startswith("oauth:"):
return token
return f"oauth:{token}"
def normalize_token(token: str) -> str:
return ensure_oauth_prefix(token)