Contact
All wechat contacts(friend) will be encapsulated as a Contact.
Classes
All wechat contacts(friend) will be encapsulated as a Contact. Examples/Contact-Bot
Typedefs
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 |
| Get Contact id. This function is depending on the Puppet Implementation, see puppet-compatible-table |
instance
.say(textOrContactOrFileOrUrl) ⇒
Promise <void>
.name() ⇒
string
.alias(newAlias) ⇒
Promise <null | string | void>
.friend() ⇒
boolean
|null
.type() ⇒
ContactType.Unknown
|ContactType.Personal
|ContactType.Official
.gender() ⇒
ContactGender.Unknown
|ContactGender.Male
|ContactGender.Female
.province() ⇒
string
|null
.city() ⇒
string
|null
.avatar() ⇒
Promise <FileBox>
.sync() ⇒
Promise <void>
.self() ⇒
boolean
static
.find(query) ⇒
Promise <Contact | null>
.findAll([queryArg]) ⇒
Promise <Contact []>
contact.say(textOrContactOrFileOrUrlLinkOrMiniProgram) ⇒ Promise <void>
Promise <void>
Tips: This function is depending on the Puppet Implementation, see puppet-compatible-table
Kind: instance method of Contact
Param | Type | Description |
textOrContactOrFileOrUrlLinkOrMiniProgram |
| send text, Contact, file or UrlLink to contact. You can use FileBox to send file |
Example
contact.name() ⇒ string
string
Get the name from a contact
Kind: instance method of Contact
Example
contact.alias(newAlias) ⇒ Promise <null | string | void>
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 |
|
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
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
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
ContactGender.Unknown
| ContactGender.Male
| ContactGender.Female
Contact gender
Tips: ContactGender is enum here.
Kind: instance method of Contact
Example
contact.province() ⇒ string
| null
string
| null
Get the region 'province' from a contact
Kind: instance method of Contact
Example
contact.city() ⇒ string
| null
string
| null
Get the region 'city' from a contact
Kind: instance method of Contact
Example
contact.avatar() ⇒ Promise <FileBox>
Promise <FileBox>
Get avatar picture file stream
Kind: instance method of Contact
Example
contact.sync() ⇒ Promise <void>
Promise <void>
Force reload data for Contact, Sync data from lowlevel API again.
Kind: instance method of Contact
Example
contact.self() ⇒ boolean
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>
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 |
query |
Example
Contact.findAll([queryArg]) ⇒ Promise <Contact []>
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 namealias
the name-string set by bot for others, should be called alias
Kind: static method of Contact
Param | Type |
queryArg |
Example
ContactQueryFilter
The way to search Contact
Kind: global typedef Properties
Name | Type | Description |
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 More Detail |
Last updated