Skip to content

Commit

Permalink
feat: 牌子是否点亮标识;普通弹幕表情信息
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiu8081 committed Sep 12, 2022
1 parent 8b97f5e commit 9ce8fa3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
interface User {
uid: number
uname: string
face?: string
badge?: {
active: boolean
name: string
level: number
color: string
Expand All @@ -21,11 +23,18 @@ interface User {
export interface DanmuMsg {
user: User
content: string
emoticon?: {
id: string
height: number
width: number
url: string
}
}

interface SuperChatMsg {
user: User
content: string
content_color: string
price: number
time: number
}
Expand Down
7 changes: 7 additions & 0 deletions src/parser/DANMU_MSG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default (data: any): DanmuMsg => {
const content = data.info[1]
const username = data.info[2][1]
const badge: DanmuMsg['user']['badge'] = data.info[3].length ? {
active: data.info[3][7] !== 12632256,
name: data.info[3][1],
level: data.info[3][0],
color: intToColorHex(data.info[3][4]),
Expand All @@ -30,5 +31,11 @@ export default (data: any): DanmuMsg => {
},
},
content,
emoticon: data.info[0][13]?.emoticon_unique ? {
id: data.info[0][13].emoticon_unique,
height: data.info[0][13].height,
width: data.info[0][13].width,
url: data.info[0][13].url,
} : undefined,
}
}

0 comments on commit 9ce8fa3

Please sign in to comment.