添加送礼目标字段
This commit is contained in:
@@ -245,6 +245,11 @@ namespace BarrageGrab.Modles.JsonEntity
|
|||||||
/// 抖币价格
|
/// 抖币价格
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int DiamondCount { get; set; }
|
public int DiamondCount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 送礼目标(连麦直播间有用)
|
||||||
|
/// </summary>
|
||||||
|
public MsgUser ToUser { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace BarrageGrab
|
|||||||
}
|
}
|
||||||
|
|
||||||
WinApi.SetConsoleCtrlHandler(cancelHandler, true);//捕获控制台关闭
|
WinApi.SetConsoleCtrlHandler(cancelHandler, true);//捕获控制台关闭
|
||||||
WinApi.DisableQuickEditMode();//禁用控制台快速编辑模式
|
WinApi.DisableQuickEditMode();//禁用控制台快速编辑模式
|
||||||
Console.Title = "抖音弹幕监听推送";
|
Console.Title = "抖音弹幕监听推送";
|
||||||
AppRuntime.DisplayConsole(!Appsetting.Current.HideConsole);
|
AppRuntime.DisplayConsole(!Appsetting.Current.HideConsole);
|
||||||
AppRuntime.WssService.Grab.Proxy.SetUpstreamProxy(Appsetting.Current.UpstreamProxy);
|
AppRuntime.WssService.Grab.Proxy.SetUpstreamProxy(Appsetting.Current.UpstreamProxy);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace BarrageGrab
|
|||||||
/// 弹幕服务
|
/// 弹幕服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class WsBarrageService
|
public class WsBarrageService
|
||||||
{
|
{
|
||||||
WebSocketServer socketServer;
|
WebSocketServer socketServer;
|
||||||
Dictionary<string, UserState> socketList = new Dictionary<string, UserState>();
|
Dictionary<string, UserState> socketList = new Dictionary<string, UserState>();
|
||||||
//礼物计数缓存
|
//礼物计数缓存
|
||||||
@@ -107,6 +107,7 @@ namespace BarrageGrab
|
|||||||
//解析用户
|
//解析用户
|
||||||
private MsgUser GetUser(User data)
|
private MsgUser GetUser(User data)
|
||||||
{
|
{
|
||||||
|
if (data == null) return null;
|
||||||
MsgUser user = new MsgUser()
|
MsgUser user = new MsgUser()
|
||||||
{
|
{
|
||||||
DisplayId = data.displayId,
|
DisplayId = data.displayId,
|
||||||
@@ -114,13 +115,13 @@ namespace BarrageGrab
|
|||||||
Gender = data.Gender,
|
Gender = data.Gender,
|
||||||
Id = data.Id,
|
Id = data.Id,
|
||||||
Level = data.Level,
|
Level = data.Level,
|
||||||
PayLevel = (int)(data.payGrade?.Level ?? 0),
|
PayLevel = (int)(data.payGrade?.Level ?? -1),
|
||||||
Nickname = data.Nickname,
|
Nickname = data.Nickname ?? "用户" + data.displayId,
|
||||||
HeadImgUrl = data.avatarThumb.urlLists.FirstOrDefault() ?? "",
|
HeadImgUrl = data.avatarThumb?.urlLists?.FirstOrDefault() ?? "",
|
||||||
SecUid = data.sec_uid,
|
SecUid = data.sec_uid,
|
||||||
FollowerCount = data.followInfo.followerCount,
|
FollowerCount = data.followInfo?.followerCount ?? -1,
|
||||||
FollowingCount = data.followInfo.followingCount,
|
FollowingCount = data.followInfo?.followingCount ?? -1,
|
||||||
FollowStatus = data.followInfo.followStatus,
|
FollowStatus = data.followInfo?.followStatus ?? -1,
|
||||||
};
|
};
|
||||||
user.FansClub = new FansClubInfo()
|
user.FansClub = new FansClubInfo()
|
||||||
{
|
{
|
||||||
@@ -139,7 +140,7 @@ namespace BarrageGrab
|
|||||||
|
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
private void PrintMsg(Msg msg, PackMsgType barType)
|
private void PrintMsg(Msg msg, PackMsgType barType)
|
||||||
{
|
{
|
||||||
var rinfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
var rinfo = AppRuntime.RoomCaches.GetCachedWebRoomInfo(msg.RoomId.ToString());
|
||||||
var roomName = (rinfo?.Owner?.Nickname ?? ("直播间" + (msg.WebRoomId == 0 ? msg.RoomId : msg.WebRoomId)));
|
var roomName = (rinfo?.Owner?.Nickname ?? ("直播间" + (msg.WebRoomId == 0 ? msg.RoomId : msg.WebRoomId)));
|
||||||
var text = $"{DateTime.Now.ToString("HH:mm:ss")} [{roomName}] [{barType}]";
|
var text = $"{DateTime.Now.ToString("HH:mm:ss")} [{roomName}] [{barType}]";
|
||||||
@@ -153,11 +154,11 @@ namespace BarrageGrab
|
|||||||
var append = msg.Content;
|
var append = msg.Content;
|
||||||
switch (barType)
|
switch (barType)
|
||||||
{
|
{
|
||||||
case PackMsgType.弹幕消息:append = $"{msg?.User?.Nickname}: {msg.Content}"; break;
|
case PackMsgType.弹幕消息: append = $"{msg?.User?.Nickname}: {msg.Content}"; break;
|
||||||
case PackMsgType.下播:append = $"直播已结束"; break;
|
case PackMsgType.下播: append = $"直播已结束"; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
text += append;
|
text += append;
|
||||||
|
|
||||||
if (Appsetting.Current.BarrageLog)
|
if (Appsetting.Current.BarrageLog)
|
||||||
@@ -181,7 +182,7 @@ namespace BarrageGrab
|
|||||||
Console.WriteLine("控制台已清理");
|
Console.WriteLine("控制台已清理");
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
console.WriteLine(text + "\n", color);
|
console.WriteLine(text + "\n", color);
|
||||||
}
|
}
|
||||||
|
|
||||||
//粉丝团
|
//粉丝团
|
||||||
@@ -296,9 +297,15 @@ namespace BarrageGrab
|
|||||||
GroupId = msg.groupId,
|
GroupId = msg.groupId,
|
||||||
GiftId = msg.giftId,
|
GiftId = msg.giftId,
|
||||||
GiftName = msg.Gift.Name,
|
GiftName = msg.Gift.Name,
|
||||||
User = GetUser(msg.User)
|
User = GetUser(msg.User),
|
||||||
|
ToUser = GetUser(msg.toUser)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (enty.ToUser != null)
|
||||||
|
{
|
||||||
|
enty.Content += ",给" + enty.ToUser.Nickname;
|
||||||
|
}
|
||||||
|
|
||||||
var msgType = PackMsgType.礼物消息;
|
var msgType = PackMsgType.礼物消息;
|
||||||
PrintMsg(enty, msgType);
|
PrintMsg(enty, msgType);
|
||||||
var pack = new BarrageMsgPack(enty.ToJson(), PackMsgType.礼物消息, e.Process);
|
var pack = new BarrageMsgPack(enty.ToJson(), PackMsgType.礼物消息, e.Process);
|
||||||
@@ -517,7 +524,7 @@ namespace BarrageGrab
|
|||||||
case CommandCode.DisplayConsole:
|
case CommandCode.DisplayConsole:
|
||||||
{
|
{
|
||||||
var display = (bool)cmdPack.Data;
|
var display = (bool)cmdPack.Data;
|
||||||
AppRuntime.DisplayConsole(display);
|
AppRuntime.DisplayConsole(display);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -612,7 +619,7 @@ namespace BarrageGrab
|
|||||||
{
|
{
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
public ConsoleColor Color { get; set; }
|
public ConsoleColor Color { get; set; }
|
||||||
|
|
||||||
public PackMsgType MsgType { get; set; }
|
public PackMsgType MsgType { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user