Skip to content

Commit

Permalink
Merge pull request #90 from juzibot/feat/room-dynamic-qrcode
Browse files Browse the repository at this point in the history
feat: ✨ add parse room dynamic qrcode and join room by this qrcode
  • Loading branch information
su-chang authored Nov 15, 2024
2 parents 71695c3 + 958f5c7 commit 7bd906a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@juzi/wechaty",
"version": "1.0.100",
"version": "1.0.101",
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
"type": "module",
"exports": {
Expand Down Expand Up @@ -109,7 +109,7 @@
},
"homepage": "https://github.com/wechaty/",
"dependencies": {
"@juzi/wechaty-puppet-service": "^1.0.96",
"@juzi/wechaty-puppet-service": "^1.0.102",
"clone-class": "^1.1.1",
"cmd-ts": "^0.10.0",
"cockatiel": "^2.0.2",
Expand All @@ -132,7 +132,7 @@
"@chatie/eslint-config": "^1.0.4",
"@chatie/semver": "^0.4.7",
"@chatie/tsconfig": "^4.6.3",
"@juzi/wechaty-puppet": "1.0.90",
"@juzi/wechaty-puppet": "1.0.93",
"@juzi/wechaty-puppet-mock": "^1.0.1",
"@swc/core": "1.3.44",
"@swc/helpers": "^0.3.6",
Expand Down
10 changes: 8 additions & 2 deletions src/user-modules/room-invitation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class RoomInvitationMixin extends wechatifyMixinBase() implements Accepter {
].join('')
}

async accept () : Promise<void>
async accept (qrcode: string) : Promise<PUPPET.types.RoomInvitationAcceptByQRCode>
/**
* Accept Room Invitation
*
Expand All @@ -102,11 +104,15 @@ class RoomInvitationMixin extends wechatifyMixinBase() implements Accepter {
* }
* .start()
*/
async accept (): Promise<void> {
async accept (qrcode?: string): Promise<void | PUPPET.types.RoomInvitationAcceptByQRCode> {
log.verbose('RoomInvitation', 'accept()')

try {
await this.wechaty.puppet.roomInvitationAccept(this.id)
if (qrcode) {
return this.wechaty.puppet.roomInvitationAcceptByQRCode(qrcode)
} else {
await this.wechaty.puppet.roomInvitationAccept(this.id)
}

const inviter = await this.inviter()
const topic = await this.topic()
Expand Down
9 changes: 9 additions & 0 deletions src/user-modules/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,15 @@ class RoomMixin extends MixinBase implements SayableSayer {
return guardQrCodeValue(qrcodeValue)
}

/**
* Parse the dynamic QR Code of the room
* @param {string} url
* @returns {Promise<PUPPET.types.RoomParseDynamicQRCode>}
*/
async parseDynamicQRCode (url: string): Promise<PUPPET.types.RoomParseDynamicQRCode> {
return this.wechaty.puppet.roomParseDynamicQRCode(url)
}

/**
* Return contact's roomAlias in the room
* @param {ContactInterface} contact
Expand Down

0 comments on commit 7bd906a

Please sign in to comment.