From 711c4fd3d605838dc01c2a1e65bda3999cbe84c9 Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sun, 9 Mar 2025 17:44:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=AE=80=E5=8C=96Steam=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除checkDiffSteamGameStatus中玩家退出游戏的冗余检查 - 优化RoundCheckSteamPlaying中的日志输出 - 删除未使用的代码片段 --- handler/steamplaying/service.go | 11 ----------- handler/steamplaying/steam_playing.go | 11 +---------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/handler/steamplaying/service.go b/handler/steamplaying/service.go index 47ba2f3..5e50200 100644 --- a/handler/steamplaying/service.go +++ b/handler/steamplaying/service.go @@ -328,17 +328,6 @@ func checkDiffSteamGameStatus(steamID []string, lastTimeStat map[string]string) } } } - - // 检查是否有玩家退出游戏 - for steamID, lastGameID := range lastTimeStat { - if lastGameID != "" { - if currentGameID, exists := currentGameStatus[steamID]; !exists || currentGameID == "" { - // 玩家已退出游戏,不需要添加到通知列表,但需要更新状态 - currentGameStatus[steamID] = "" - } - } - } - return gameStatusListStr, Players, nil } diff --git a/handler/steamplaying/steam_playing.go b/handler/steamplaying/steam_playing.go index 3deb45e..5fa3265 100644 --- a/handler/steamplaying/steam_playing.go +++ b/handler/steamplaying/steam_playing.go @@ -25,8 +25,6 @@ func init() { handler.RegisterHelpInform("绑steam", "steam", "输入steamID,绑定您的steam账号。可以通过客户端右上角-账户明细 https://store.steampowered.com/account/ 查看,steamID位于页面左上角") handler.RegisterHandler("启用上号通知", bindSteamInGroup, constants.LEVEL_USER) handler.RegisterHelpInform("启用上号通知", "steam", "在群内启用您的steam上号通知") - // handler.RegisterHandler("群通报steam", bindSteamInGroupBroadCast, constants.LEVEL_USER) - // handler.RegisterHelpInform("群通报steam", "在群内启用你的steam游戏上线通报") handler.RegisterHandler("解绑steam", unbindSteam, constants.LEVEL_USER) handler.RegisterHelpInform("解绑steam", "steam", "解绑您的steam账号,并解绑所有群监听") handler.RegisterHandler("禁用上号通知", unbindSteamInGroup, constants.LEVEL_USER) @@ -239,18 +237,11 @@ func RoundCheckSteamPlaying() { } } - // 处理新上线的玩家 - for steamId := range gamePlayingMap { - if _, exists := playingMap[steamId]; !exists { - delete(exitInfoMap, steamId) // 新上线的玩家,清除可能存在的退出记录 - } - } - for _, group := range groups { time.Sleep(15 * time.Second) users, err := getSteamUsersInGroup(group) if err != nil { - fmt.Println("获取群成员steam列表失败: ", err) + log.Println("获取群成员steam列表失败: ", err) continue } var steamIds []string