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
string
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
Example
contact.name() ⇒ string
stringGet 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
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
boolean | nullCheck 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.OfficialReturn 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.FemaleContact gender
Tips: ContactGender is enum here.
Kind: instance method of Contact Example
contact.province() ⇒ string | null
string | nullGet the region 'province' from a contact
Kind: instance method of Contact Example
contact.city() ⇒ string | null
string | nullGet 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
booleanCheck 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
namethe name-string set by user-self, should be called namealiasthe 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
string
The name-string set by user-self, should be called name
Last updated
Was this helpful?