Packages

c

wechaty.user

Contact

class Contact extends Conversation with LazyLogging

All wechat contacts(friend) will be encapsulated as a Contact. [Examples/Contact-Bot]https://github.com/wechaty/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts

Since

2020-06-03

Linear Supertypes
LazyLogging, Conversation, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Contact
  2. LazyLogging
  3. Conversation
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Contact(contactId: String)(implicit resolver: PuppetResolver)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def alias(newAlias: String): String

    GET / SET / DELETE the alias for a contact

    GET / SET / DELETE the alias for a contact

    Tests show it will failed if set alias too frequently(60 times in one minute).

    Examples:
    1. GET the alias for a contact, return {(Promise)} const alias = await contact.alias() if (alias === null) { console.log('You have not yet set any alias for contact ' + contact.name()) } else { console.log('You have already set an alias for contact ' + contact.name() + ':' + alias) }

    2. ,
    3. SET the alias for a contact try { await contact.alias('lijiarui') console.log(change ${contact.name()}'s alias successfully!) } catch (e) { console.log(failed to change ${contact.name()} alias!) }

    4. ,
    5. DELETE the alias for a contact try { const oldAlias = await contact.alias(null) console.log(delete ${contact.name()}'s alias successfully!) console.log('old alias is ${oldAlias}) } catch (e) { console.log(failed to delete ${contact.name()}'s alias!) }

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def avatar: ResourceBox
  7. def city(): String

    Get the region 'city' from a contact

    Get the region 'city' from a contact

    Example:
    1. const city = contact.city()

  8. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def friend(): Boolean

    Check if contact is friend

    Check if contact is friend

    > Tips: This function is depending on the Puppet Implementation, see [puppet-compatible-table](https://github.com/wechaty/wechaty/wiki/Puppet#3-puppet-compatible-table)

    Example:
    1. const isFriend = contact.friend()

  13. def gender(): Type

    Contact gender > Tips: ContactGender is enum here.

    Contact gender > Tips: ContactGender is enum here.

    Example:
    1. const gender = contact.gender() === bot.Contact.Gender.Male

  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. val id: String
    Definition Classes
    Conversation
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def isReady(): Boolean

  19. lazy val logger: Logger
    Attributes
    protected
    Definition Classes
    LazyLogging
    Annotations
    @transient()
  20. def name: String

    Get the name from a contact

    Get the name from a contact

    Example:
    1. const name = contact.name()

  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. def payload: ContactPayload
  25. def province(): String

    Get the region 'province' from a contact

    Get the region 'province' from a contact

    Example:
    1. const province = contact.province()

  26. def ready(forceSync: Boolean = false): Unit

    ready() is For FrameWork ONLY!

    ready() is For FrameWork ONLY!

    Please not to use ready() at the user land. If you want to sync data, uyse sync() instead.

  27. def say(something: ResourceBox): Message
    Definition Classes
    Conversation
  28. def say(something: MiniProgram): Message
    Definition Classes
    Conversation
  29. def say(something: UrlLink): Message
    Definition Classes
    Conversation
  30. def say(something: Contact): Message
    Definition Classes
    Conversation
  31. def say(something: String): Message
    Definition Classes
    Conversation
  32. def self(): Boolean

    Check if contact is self

    Check if contact is self

    Example:
    1. const isSelf = contact.self()

  33. def star(): Boolean

    Example:
    1. const isStar = contact.star()

  34. def sync(): Unit

    Force reload data for Contact, Sync data from lowlevel API again.

    Force reload data for Contact, Sync data from lowlevel API again.

    Example:
    1. await contact.sync()

  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. def tags(): Array[Tag]

    Get all tags of contact

    Get all tags of contact

    Example:
    1. const tags = await contact.tags()

  37. def toString(): String
    Definition Classes
    Contact → AnyRef → Any
  38. def type(): Type

    Return the type of the Contact > Tips: ContactType is enum here.

    Return the type of the Contact > Tips: ContactType is enum here.

    Example:
    1. const bot = new Wechaty() await bot.start() const isOfficial = contact.type() === bot.Contact.Type.Official

  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  42. def weixin(): String

    Get the weixin number from a contact.

    Get the weixin number from a contact.

    Sometimes cannot get weixin number due to weixin security mechanism, not recommend.

    Example:
    1. const weixin = contact.weixin()

Deprecated Value Members

  1. def stranger(): Boolean

    Deprecated

Inherited from LazyLogging

Inherited from Conversation

Inherited from AnyRef

Inherited from Any

Ungrouped