diff --git a/BarrageGrab/JsonEntity/BarrageMessages.cs b/BarrageGrab/JsonEntity/BarrageMessages.cs index f6f8c79..a5430b7 100644 --- a/BarrageGrab/JsonEntity/BarrageMessages.cs +++ b/BarrageGrab/JsonEntity/BarrageMessages.cs @@ -115,12 +115,17 @@ /// 用户弹幕信息 /// public class MsgUser - { + { /// /// 真实ID /// public long Id { get; set; } + /// + /// ShortId + /// + public long ShortId { get; set; } + /// /// 自定义ID /// @@ -132,10 +137,15 @@ public string Nickname { get; set; } /// - /// 等级 + /// 未知 /// public int Level { get; set; } + /// + /// 支付等级 + /// + public int PayLevel { get; set; } + /// /// 性别 1男 2女 /// @@ -154,7 +164,23 @@ /// /// 粉丝团信息 /// - public FansClubInfo FansClub { get; set; } + public FansClubInfo FansClub { get; set; } + + /// + /// 粉丝数 + /// + public long FollowerCount { get; set; } + + /// + /// 关注状态 0 未关注 1 已关注 2,不明 + /// + public long FollowStatus { get; set; } + + /// + /// 关注数 + /// + public long FollowingCount; + public string GenderToString() { @@ -177,6 +203,11 @@ /// public string GiftName { get; set; } + /// + /// 礼物分组ID + /// + public long GroupId { get; set; } + /// /// 本次(增量)礼物数量 /// @@ -244,6 +275,11 @@ /// 粉丝团消息类型,升级1,加入2 /// public int Type { get; set; } + + /// + /// 粉丝团等级 + /// + public int Level { get; set; } } /// diff --git a/BarrageGrab/WsBarrageService.cs b/BarrageGrab/WsBarrageService.cs index 024a99c..e4c1c56 100644 --- a/BarrageGrab/WsBarrageService.cs +++ b/BarrageGrab/WsBarrageService.cs @@ -85,12 +85,17 @@ namespace BarrageGrab MsgUser user = new MsgUser() { DisplayId = data.displayId, + ShortId = data.shortId, Gender = data.Gender, Id = data.Id, Level = data.Level, + PayLevel = (int)(data.payGrade?.Level??0), Nickname = data.Nickname, HeadImgUrl = data.avatarThumb.urlLists.FirstOrDefault() ?? "", - SecUid = data.sec_uid + SecUid = data.sec_uid, + FollowerCount = data.followInfo.followerCount, + FollowingCount = data.followInfo.followingCount, + FollowStatus = data.followInfo.followStatus, }; user.FansClub = new FansClubInfo() { @@ -101,7 +106,7 @@ namespace BarrageGrab if (data.fansClub != null && data.fansClub.Data != null) { user.FansClub.ClubName = data.fansClub.Data.clubName; - user.Level = data.fansClub.Data.Level; + user.FansClub.Level = data.fansClub.Data.Level; } return user; @@ -116,9 +121,10 @@ namespace BarrageGrab MsgId = e.Common.msgId, Content = e.Content, RoomId = e.Common.roomId, - Type = e.Type, + Type = e.Type, User = GetUser(e.User) }; + enty.Level = enty.User.FansClub.Level; Print(enty.User.GenderToString() + " " + enty.Content, ConsoleColor.Blue, BarrageMsgType.粉丝团消息); var pack = new BarrageMsgPack(JsonConvert.SerializeObject(enty), BarrageMsgType.粉丝团消息); var json = JsonConvert.SerializeObject(pack); @@ -208,11 +214,13 @@ namespace BarrageGrab DiamondCount = e.Gift.diamondCount, RepeatCount = currCount, GiftCount = count, + GroupId = e.groupId, GiftId = e.giftId, GiftName = e.Gift.Name, User = GetUser(e.User) }; - + + Print($"{enty.User.GenderToString()} {enty.Content}", ConsoleColor.Red, BarrageMsgType.礼物消息); var pack = new BarrageMsgPack(JsonConvert.SerializeObject(enty), BarrageMsgType.礼物消息); var json = JsonConvert.SerializeObject(pack); @@ -315,7 +323,14 @@ namespace BarrageGrab RoomId = e.Common.roomId, User = GetUser(e.User) }; + + Print($"{enty.User.GenderToString()} {enty.User.Nickname}: {enty.Content}", ConsoleColor.White, BarrageMsgType.弹幕消息); + if (e.User.followInfo.followStatus != 1 && e.User.followInfo.followStatus != 0 && e.User.followInfo.followStatus != 2) + { + Console.WriteLine(e.User.followInfo.followStatus); + } + var pack = new BarrageMsgPack(JsonConvert.SerializeObject(enty), BarrageMsgType.弹幕消息); var json = JsonConvert.SerializeObject(pack); this.Broadcast(json); diff --git a/README.md b/README.md index 9e98092..8925286 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,10 @@ ## ⛳近期更新 +2023-04-24 v2.6.5 + + 1.新增了若干用户字段,包括用户shortid,粉丝数,关注数,主播关注状态,消费等级,并修正了粉丝团等级的错误赋值;礼物消息新增了GroupId用于帮助区分礼物连送分组; 字段详解见 [BarrageMessages.cs](./BarrageGrab/JsonEntity/BarrageMessages.cs) + 2023-04-10 v2.6.4 1. 修改为礼物消息为增量推送,不再逐个推送,增量字段为GiftCount @@ -20,14 +24,6 @@ 1. 丰富了用户的数据信息,支持房间号过滤(见配置文件) -2023-03-09 v2.6.0 - -1. 针对直播伴侣抓不到的问题 放宽了域名规则限制(个人没几个粉丝,不好测试,有问题请第一时间提出) - -2. 添加了更多配置项,请再次查看[配置说明](#tag1) - -3. 添加了域名成功解包的日志记录,用于在出现问题的情况下手动调配,见[详细描述](#tag2) - ## 😎介绍及配置