Wechaty
NewsBlogDevelopersDocs
中文版
中文版
  • 介绍
  • 快速开始
  • API 文档
    • Wechaty
    • Message
    • Contact
    • ContactSelf
    • Room
    • RoomInvitation
    • Friendship
  • 示例代码
  • Puppet
  • 常见问题
  • 最佳实践
  • 参与贡献
  • 了解更多
    • 视频教程
    • 进阶
    • 测试
    • 目录结构
    • ReleaseLog
    • ChangeLog
    • Awesome Wechaty
    • Contributors
    • 关于token的所有问题
Powered by GitBook
On this page
  • RoomInvitation
  • roomInvitation.accept() ⇒ Promise <void>
  • roomInvitation.inviter() ⇒ Promise <Contact>
  • roomInvitation.topic() ⇒ Promise <string>
  • roomInvitation.roomTopic()
  • roomInvitation.date() ⇒ Promise <Date>
  • roomInvitation.age() ⇒ Promise <number>

Was this helpful?

  1. API 文档

RoomInvitation

自动通过入群邀请

PreviousRoomNextFriendship

Last updated 5 years ago

Was this helpful?

RoomInvitation

自动通过入群邀请

Kind: global class

    • ⇒ Promise <void>

    • ⇒ Promise <Contact>

    • ⇒ Promise <string>

    • ⇒ Promise <string>

    • ⇒ Promise <Date>

    • ⇒ Promise <number>

roomInvitation.accept() ⇒ Promise <void>

自动通过入群邀请

Kind: instance method of Example

const bot = new Wechaty()
bot.on('room-invite', async roomInvitation => {
  try {
    console.log(`received room-invite event.`)
    await roomInvitation.accept()
  } catch (e) {
    console.error(e)
  }
}
.start()

roomInvitation.inviter() ⇒ Promise <Contact>

获取发送入群邀请的联系人。

const bot = new Wechaty()
bot.on('room-invite', async roomInvitation => {
  const inviter = await roomInvitation.inviter()
  const name = inviter.name()
  console.log(`received room invitation event from ${name}`)
}
.start()

roomInvitation.topic() ⇒ Promise <string>

获取需要进的群的群名称.

const bot = new Wechaty()
bot.on('room-invite', async roomInvitation => {
  const topic = await roomInvitation.topic()
  console.log(`received room invitation event from room ${topic}`)
}
.start()

roomInvitation.roomTopic()

roomInvitation.date() ⇒ Promise <Date>

获取发送入群邀请的时间。

roomInvitation.age() ⇒ Promise <number>

获取入群邀请的时间间隔。

例如:入群邀请的发送时间在 8:43:01, 当我们在Wechaty 上收到这个信息的时间是 8:43:15, 那么 age() 的值为: 8:43:15 - 8:43:01 = 14 (seconds)

Kind: instance method of Example

Kind: instance method of Example

Kind: instance method of Deprecated:: 请使用

Kind: instance method of

Kind: instance method of

RoomInvitation
.accept()
.inviter()
.topic()
.roomTopic()
.date()
.age()
RoomInvitation
RoomInvitation
RoomInvitation
RoomInvitation
topic()
RoomInvitation
RoomInvitation