Packages

c

wechaty.user

Contact

class Contact extends Conversation with LoggerSupport

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
LoggerSupport, Conversation, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Contact
  2. LoggerSupport
  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. def debug(message: String, args: Any*): Unit
    Attributes
    protected
    Definition Classes
    LoggerSupport
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def error(message: String, e: Throwable): Unit
    Attributes
    protected
    Definition Classes
    LoggerSupport
  13. def error(message: String, args: Any*): Unit
    Attributes
    protected
    Definition Classes
    LoggerSupport
  14. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. 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()

  16. 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

  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. val id: String
    Definition Classes
    Conversation
  20. def info(message: String, args: Any*): Unit
    Attributes
    protected
    Definition Classes
    LoggerSupport
  21. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  22. def isReady(): Boolean

  23. val logger: Logger
    Attributes
    protected
    Definition Classes
    LoggerSupport
  24. def name: String

    Get the name from a contact

    Get the name from a contact

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

  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. def payload: ContactPayload
  29. def province(): String

    Get the region 'province' from a contact

    Get the region 'province' from a contact

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

  30. 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.

  31. def say(something: MiniProgram): Message
    Definition Classes
    Conversation
  32. def say(something: UrlLink): Message
    Definition Classes
    Conversation
  33. def say(something: Contact): Message
    Definition Classes
    Conversation
  34. def say(something: String): Message
    Definition Classes
    Conversation
  35. def self(): Boolean

    Check if contact is self

    Check if contact is self

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

  36. def star(): Boolean

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

  37. 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()

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

    Get all tags of contact

    Get all tags of contact

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

  40. def toString(): String
    Definition Classes
    Contact → AnyRef → Any
  41. 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

  42. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  45. def warn(message: String, args: Any*): Unit
    Attributes
    protected
    Definition Classes
    LoggerSupport
  46. 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 LoggerSupport

Inherited from Conversation

Inherited from AnyRef

Inherited from Any

Ungrouped