1 | import makeProto from '../wrap'
|
2 | import { partial, parseDate } from '../util'
|
3 |
|
4 | export default function wrapNotification (mp, notif) {
|
5 | notif.id = Number(notif.id)
|
6 | notif.timestamp = parseDate(notif.timestamp)
|
7 |
|
8 | if (notif.action === 'levelUp') {
|
9 | notif.level = Number(notif.value)
|
10 | }
|
11 |
|
12 | if (notif.action === 'gift') {
|
13 | const parts = notif.value.split('\u2800')
|
14 | notif.from = parts[0]
|
15 | notif.amount = Number(parts[1])
|
16 | }
|
17 |
|
18 | if (notif.action === 'custom') {
|
19 | notif.message = notif.value
|
20 | }
|
21 |
|
22 | return makeProto(notif, {
|
23 | acknowledge: partial(mp.acknowledgeNotification, notif.id)
|
24 | })
|
25 | }
|