File tree 9 files changed +11
-11
lines changed
9 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " blive-message-listener" ,
3
- "version" : " 0.1.4 " ,
3
+ "version" : " 0.1.5 " ,
4
4
"description" : " Bilibili-live danmu listener with type" ,
5
5
"type" : " module" ,
6
6
"main" : " dist/index.js" ,
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ export type MsgHandler = Partial<
18
18
& WatchedChangeHandler
19
19
>
20
20
21
- const normalizeDanmu = < T > ( msgType : string , data : T ) : Message < T > => {
21
+ const normalizeDanmu = < T > ( msgType : string , body : T ) : Message < T > => {
22
22
const timestamp = Date . now ( )
23
23
// @ts -ignore
24
- const id = `${ timestamp } _${ msgType } _${ data . user ?. uid } `
24
+ const id = `${ timestamp } _${ msgType } _${ body . user ?. uid } `
25
25
return {
26
26
id,
27
27
timestamp,
28
28
type : msgType ,
29
- data ,
29
+ body ,
30
30
}
31
31
}
32
32
Original file line number Diff line number Diff line change @@ -55,5 +55,5 @@ export const DANMU_MSG = {
55
55
}
56
56
57
57
export type Handler = {
58
- onIncomeDanmu : ( data : Message < DanmuMsg > ) => void
58
+ onIncomeDanmu : ( msg : Message < DanmuMsg > ) => void
59
59
}
Original file line number Diff line number Diff line change @@ -39,5 +39,5 @@ export const GUARD_BUY = {
39
39
}
40
40
41
41
export type Handler = {
42
- onGuardBuy : ( data : Message < GuardBuyMsg > ) => void
42
+ onGuardBuy : ( msg : Message < GuardBuyMsg > ) => void
43
43
}
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ export const HEARTBEAT = {
18
18
}
19
19
20
20
export type Handler = {
21
- onAttentionChange : ( data : Message < AttentionChangeMsg > ) => void
21
+ onAttentionChange : ( msg : Message < AttentionChangeMsg > ) => void
22
22
}
Original file line number Diff line number Diff line change @@ -51,5 +51,5 @@ export const SEND_GIFT = {
51
51
}
52
52
53
53
export type Handler = {
54
- onGift : ( data : Message < GiftMsg > ) => void
54
+ onGift : ( msg : Message < GiftMsg > ) => void
55
55
}
Original file line number Diff line number Diff line change @@ -50,5 +50,5 @@ export const SUPER_CHAT_MESSAGE = {
50
50
}
51
51
52
52
export type Handler = {
53
- onIncomeSuperChat : ( data : Message < SuperChatMsg > ) => void
53
+ onIncomeSuperChat : ( msg : Message < SuperChatMsg > ) => void
54
54
}
Original file line number Diff line number Diff line change @@ -22,5 +22,5 @@ export const WATCHED_CHANGE = {
22
22
}
23
23
24
24
export type Handler = {
25
- onWatchedChange : ( data : Message < WatchedChangeMsg > ) => void
25
+ onWatchedChange : ( msg : Message < WatchedChangeMsg > ) => void
26
26
}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export interface Message<T> {
48
48
id : string ,
49
49
timestamp : number ,
50
50
type : string ,
51
- data : T
51
+ body : T
52
52
}
53
53
54
54
export interface BaseMsg {
You can’t perform that action at this time.
0 commit comments