解决冲突

This commit is contained in:
小白猿
2023-02-21 19:16:08 +08:00
2 changed files with 51 additions and 1 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using BarrageGrab.ProtoEntity;
using ProtoBuf;
using ColorConsole;
namespace BarrageGrab
{
@@ -17,6 +18,7 @@ namespace BarrageGrab
{
FiddlerProxy proxy = new FiddlerProxy();
Appsetting appsetting = Appsetting.Get();
ConsoleWriter console = new ConsoleWriter();
/// <summary>
/// 进入直播间
@@ -187,7 +189,7 @@ namespace BarrageGrab
}
else
{
console.WriteLine("未能识别的礼物ID:" + arg.giftId, ConsoleColor.Red);
break;
}
}
+48
View File
@@ -0,0 +1,48 @@
from websocket import connection
import json
def ck(data):#type2
txt=data.get("Data")
load_data=json.loads(txt)
print("感谢"+load_data.get("Content"))
def welcome(data):#type3
json1=data.get("Data")
Nickname=json.loads(json1)
json2=Nickname.get("User")
print("欢迎:"+json2["Nickname"])
def thank(data):#type5
txt=data.get("Data")
load_data=json.loads(txt)
print("感谢"+load_data.get("Content"))
def check(data):#type6
txt=data.get("Data")
load_data=json.loads(txt)
print(load_data.get("Content"))
def main():
try:
ws = create_connection("ws://127.0.0.1:8888")
ws.send("token")
while(True):
result = ws.recv()
load_data=json.loads(result)
type=load_data.get("Type")#标签类型
if type==1:#1用户发言
msg(load_data)
elif type==2:#2用户点赞
ck(load_data)
elif type==3:#3用户入房
welcome(load_data)
elif type==4:#用户关注
print(str(load_data))
elif type==5:#5用户礼物
thank(load_data)
elif type==6:#6人数统计
check(load_data)
ws.close()
except:
ws.close
main()