fix(discord): 修复 WebSocket 连接检测并增强跨平台文件处理 (#73)
修复 Discord WebSocket 连接检测逻辑,使用正确的属性检查连接状态 为跨平台消息处理添加文件类型支持,并增加详细的调试日志 优化附件处理逻辑,确保所有文件类型都能正确识别和转发
This commit is contained in:
@@ -327,7 +327,9 @@ class DiscordAdapter(discord.Client if DISCORD_AVAILABLE else object):
|
||||
try:
|
||||
await asyncio.sleep(interval)
|
||||
|
||||
if self.ws is not None and self.ws.closed:
|
||||
# discord.py 的 ws 对象是 DiscordWebSocket,它没有 closed 属性
|
||||
# 我们可以通过检查 self.is_closed() 或者 ws.open 来判断
|
||||
if self.ws is not None and not getattr(self.ws, 'open', True):
|
||||
self.logger.warning("检测到 WebSocket 连接已关闭,触发重连...")
|
||||
await self.close()
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user