Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
atorber committed Apr 18, 2024
2 parents baed15d + 78dbc60 commit 4b5749f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/puppet-bridge-atorber-fused.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class PuppetBridge extends PUPPET.Puppet {
type = PUPPET.types.Message.Audio
break
case 37:
type = PUPPET.types.Message.Contact
break
case 40:
break
Expand Down Expand Up @@ -551,7 +552,12 @@ class PuppetBridge extends PUPPET.Puppet {
} else {
this.messageStore[payload.id] = payload
if (this.isReady) {
this.emit('message', { messageId: payload.id })
if (code === 37) {
this.emit('friendship', { friendshipId: payload.id })
} else {
this.emit('message', { messageId: payload.id })
}

} else {
log.info('isReady is false, wait for ready...')
}
Expand Down Expand Up @@ -1414,10 +1420,13 @@ class PuppetBridge extends PUPPET.Puppet {
*
*/
override async friendshipRawPayload (id: string): Promise<any> {
return { id } as any
return this.messageStore[id]
}

override async friendshipRawPayloadParser (rawPayload: any): Promise<PUPPET.payloads.Friendship> {
rawPayload.contactId = rawPayload.text.match(/fromusername="([^"]*)"/)[1]
rawPayload.type = 2
rawPayload.hello = rawPayload.text.match(/content="([^"]*)"/)[1]
return rawPayload
}

Expand Down

0 comments on commit 4b5749f

Please sign in to comment.