Contact

All wechat contacts(friend) will be encapsulated as a Contact.

Classes

Contact

All wechat contacts(friend) will be encapsulated as a Contact. Examples/Contact-Bot

Typedefs

ContactQueryFilter

The way to search Contact

Contact

All wechat contacts(friend) will be encapsulated as a Contact. Examples/Contact-Bot

Kind: global class Properties

Name

Type

Description

id

string

Get Contact id. This function is depending on the Puppet Implementation, see puppet-compatible-table

contact.say(textOrContactOrFileOrUrlLinkOrMiniProgram) ⇒ Promise <void>

Tips: This function is depending on the Puppet Implementation, see puppet-compatible-table

Kind: instance method of Contact

Param

Type

Description

textOrContactOrFileOrUrlLinkOrMiniProgram

string | Contact | FileBox | UrlLink | MiniProgram

send text, Contact, file or UrlLink to contact. You can use FileBox to send file

Example

contact.name() ⇒ string

Get the name from a contact

Kind: instance method of Contact Example

contact.alias(newAlias) ⇒ Promise <null | string | void>

GET / SET / DELETE the alias for a contact

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

Kind: instance method of Contact

Param

Type

newAlias

none | string | null

Example ( GET the alias for a contact, return {(Promise<string | null>)})

Example (SET the alias for a contact)

Example (DELETE the alias for a contact)

contact.friend() ⇒ boolean | null

Check if contact is friend

Tips: This function is depending on the Puppet Implementation, see puppet-compatible-table

Kind: instance method of Contact Returns: boolean | null - True for friend of the bot False for not friend of the bot, null for unknown. Example

contact.type() ⇒ ContactType.Unknown | ContactType.Personal | ContactType.Official

Return the type of the Contact

Tips: ContactType is enum here.

Kind: instance method of Contact Example

contact.gender() ⇒ ContactGender.Unknown | ContactGender.Male | ContactGender.Female

Contact gender

Tips: ContactGender is enum here.

Kind: instance method of Contact Example

contact.province() ⇒ string | null

Get the region 'province' from a contact

Kind: instance method of Contact Example

contact.city() ⇒ string | null

Get the region 'city' from a contact

Kind: instance method of Contact Example

contact.avatar() ⇒ Promise <FileBox>

Get avatar picture file stream

Kind: instance method of Contact Example

contact.sync() ⇒ Promise <void>

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

Kind: instance method of Contact Example

contact.self() ⇒ boolean

Check if contact is self

Kind: instance method of Contact Returns: boolean - True for contact is self, False for contact is others Example

Contact.find(query) ⇒ Promise <Contact | null>

Try to find a contact by filter: {name: string | RegExp} / {alias: string | RegExp}

Find contact by name or alias, if the result more than one, return the first one.

Kind: static method of Contact Returns: Promise. - If can find the contact, return Contact, or return null

Param

Type

Example

Contact.findAll([queryArg]) ⇒ Promise <Contact []>

Find contact by name or alias

If use Contact.findAll() get the contact list of the bot.

definition

  • name the name-string set by user-self, should be called name

  • alias the name-string set by bot for others, should be called alias

Kind: static method of Contact

Param

Type

Example

ContactQueryFilter

The way to search Contact

Kind: global typedef Properties

Name

Type

Description

name

string

The name-string set by user-self, should be called name

alias

string

The name-string set by bot for others, should be called alias More Detail

Last updated

Was this helpful?