mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +08:00
parent
f1918ea37f
commit
1f2073fc3b
|
@ -36,7 +36,15 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 房间信息更新
|
/// 房间信息更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RoomChange
|
RoomChange,
|
||||||
|
/// <summary>
|
||||||
|
/// 房间被锁定
|
||||||
|
/// </summary>
|
||||||
|
RoomLock,
|
||||||
|
/// <summary>
|
||||||
|
/// 直播被切断
|
||||||
|
/// </summary>
|
||||||
|
CutOff,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class DanmakuModel
|
internal class DanmakuModel
|
||||||
|
@ -181,15 +189,15 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case "LIVE":
|
case "LIVE": // 开播
|
||||||
this.MsgType = DanmakuMsgType.LiveStart;
|
this.MsgType = DanmakuMsgType.LiveStart;
|
||||||
this.RoomID = obj["roomid"]?.ToObject<string>();
|
this.RoomID = obj["roomid"]?.ToObject<string>();
|
||||||
break;
|
break;
|
||||||
case "PREPARING":
|
case "PREPARING": // 下播
|
||||||
this.MsgType = DanmakuMsgType.LiveEnd;
|
this.MsgType = DanmakuMsgType.LiveEnd;
|
||||||
this.RoomID = obj["roomid"]?.ToObject<string>();
|
this.RoomID = obj["roomid"]?.ToObject<string>();
|
||||||
break;
|
break;
|
||||||
case "DANMU_MSG":
|
case "DANMU_MSG": // 弹幕
|
||||||
this.MsgType = DanmakuMsgType.Comment;
|
this.MsgType = DanmakuMsgType.Comment;
|
||||||
this.CommentText = obj["info"]?[1]?.ToObject<string>();
|
this.CommentText = obj["info"]?[1]?.ToObject<string>();
|
||||||
this.UserID = obj["info"]?[2]?[0]?.ToObject<long>() ?? 0;
|
this.UserID = obj["info"]?[2]?[0]?.ToObject<long>() ?? 0;
|
||||||
|
@ -198,14 +206,14 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
this.IsVIP = obj["info"]?[2]?[3]?.ToObject<string>() == "1";
|
this.IsVIP = obj["info"]?[2]?[3]?.ToObject<string>() == "1";
|
||||||
this.UserGuardLevel = obj["info"]?[7]?.ToObject<int>() ?? 0;
|
this.UserGuardLevel = obj["info"]?[7]?.ToObject<int>() ?? 0;
|
||||||
break;
|
break;
|
||||||
case "SEND_GIFT":
|
case "SEND_GIFT": // 送礼物
|
||||||
this.MsgType = DanmakuMsgType.GiftSend;
|
this.MsgType = DanmakuMsgType.GiftSend;
|
||||||
this.GiftName = obj["data"]?["giftName"]?.ToObject<string>();
|
this.GiftName = obj["data"]?["giftName"]?.ToObject<string>();
|
||||||
this.UserName = obj["data"]?["uname"]?.ToObject<string>();
|
this.UserName = obj["data"]?["uname"]?.ToObject<string>();
|
||||||
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
||||||
this.GiftCount = obj["data"]?["num"]?.ToObject<int>() ?? 0;
|
this.GiftCount = obj["data"]?["num"]?.ToObject<int>() ?? 0;
|
||||||
break;
|
break;
|
||||||
case "GUARD_BUY":
|
case "GUARD_BUY": // 购买舰长
|
||||||
{
|
{
|
||||||
this.MsgType = DanmakuMsgType.GuardBuy;
|
this.MsgType = DanmakuMsgType.GuardBuy;
|
||||||
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
this.UserID = obj["data"]?["uid"]?.ToObject<long>() ?? 0;
|
||||||
|
@ -215,7 +223,7 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
this.GiftCount = obj["data"]?["num"]?.ToObject<int>() ?? 0;
|
this.GiftCount = obj["data"]?["num"]?.ToObject<int>() ?? 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "SUPER_CHAT_MESSAGE":
|
case "SUPER_CHAT_MESSAGE": // SC
|
||||||
{
|
{
|
||||||
this.MsgType = DanmakuMsgType.SuperChat;
|
this.MsgType = DanmakuMsgType.SuperChat;
|
||||||
this.CommentText = obj["data"]?["message"]?.ToString();
|
this.CommentText = obj["data"]?["message"]?.ToString();
|
||||||
|
@ -225,7 +233,7 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
this.SCKeepTime = obj["data"]?["time"]?.ToObject<int>() ?? 0;
|
this.SCKeepTime = obj["data"]?["time"]?.ToObject<int>() ?? 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "ROOM_CHANGE":
|
case "ROOM_CHANGE": // 房间信息变更
|
||||||
{
|
{
|
||||||
this.MsgType = DanmakuMsgType.RoomChange;
|
this.MsgType = DanmakuMsgType.RoomChange;
|
||||||
this.Title = obj["data"]?["title"]?.ToObject<string>();
|
this.Title = obj["data"]?["title"]?.ToObject<string>();
|
||||||
|
@ -233,6 +241,16 @@ namespace BililiveRecorder.Core.Api.Danmaku
|
||||||
this.ParentAreaName = obj["data"]?["parent_area_name"]?.ToObject<string>();
|
this.ParentAreaName = obj["data"]?["parent_area_name"]?.ToObject<string>();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "ROOM_LOCK": // 房间被锁定
|
||||||
|
{
|
||||||
|
this.MsgType = DanmakuMsgType.RoomLock;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "CUT_OFF": // 直播被切断
|
||||||
|
{
|
||||||
|
this.MsgType = DanmakuMsgType.CutOff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
this.MsgType = DanmakuMsgType.Unknown;
|
this.MsgType = DanmakuMsgType.Unknown;
|
||||||
|
|
|
@ -549,6 +549,12 @@ retry:
|
||||||
this.AreaNameParent = d.ParentAreaName ?? this.AreaNameParent;
|
this.AreaNameParent = d.ParentAreaName ?? this.AreaNameParent;
|
||||||
this.AreaNameChild = d.AreaName ?? this.AreaNameChild;
|
this.AreaNameChild = d.AreaName ?? this.AreaNameChild;
|
||||||
break;
|
break;
|
||||||
|
case Api.Danmaku.DanmakuMsgType.RoomLock:
|
||||||
|
this.logger.Information("直播间被封禁");
|
||||||
|
break;
|
||||||
|
case Api.Danmaku.DanmakuMsgType.CutOff:
|
||||||
|
this.logger.Information("直播被管理员切断");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user