删除系统提示防止在无GUI环境中出错

pull/35/head
UnCLAS-Prommer 2025-06-22 11:05:09 +08:00
parent eb823f056b
commit a76e8b8ef4
2 changed files with 1 additions and 13 deletions

View File

@ -6,4 +6,3 @@ maim_message
loguru loguru
pillow pillow
tomli tomli
plyer

View File

@ -7,8 +7,6 @@ import json
import websockets as Server import websockets as Server
from typing import List, Tuple, Optional, Dict, Any from typing import List, Tuple, Optional, Dict, Any
import uuid import uuid
from plyer import notification
import os
from . import MetaEventType, RealMessageType, MessageType, NoticeType from . import MetaEventType, RealMessageType, MessageType, NoticeType
from maim_message import ( from maim_message import (
@ -66,15 +64,6 @@ class RecvHandler:
now_time = time.time() now_time = time.time()
if now_time - self.last_heart_beat > self.interval * 2: if now_time - self.last_heart_beat > self.interval * 2:
logger.error(f"Bot {id} 连接已断开被下线或者Napcat卡死") logger.error(f"Bot {id} 连接已断开被下线或者Napcat卡死")
current_dir = os.path.dirname(__file__)
icon_path = os.path.join(current_dir, "..", "assets", "maimai.ico")
notification.notify(
title="警告",
message=f"Bot {id} 连接已断开被下线或者Napcat卡死",
app_name="MaiBot Napcat Adapter",
timeout=10,
app_icon=icon_path,
)
break break
else: else:
logger.debug("心跳正常") logger.debug("心跳正常")