diff --git a/src/contact.ts b/src/contact.ts index b56bec701aad2319cc3eb1980cba74961cb6fa48..3d83b080f9b140db85785b92818d93424d317d4f 100644 --- a/src/contact.ts +++ b/src/contact.ts @@ -21,7 +21,7 @@ type ContactObj = { id: string name: string province: string - remark: string + remark: string|null sex: string signature: string star: boolean @@ -222,8 +222,12 @@ export class Contact implements Sayable { * set the remark for contact */ public remark(newRemark: string): Promise + /** + * delete the remark for a contact + */ + public remark(empty: null): Promise - public remark(newRemark?: string): Promise | string { + public remark(newRemark?: string|null): Promise | string { log.silly('Contact', 'remark(%s)', newRemark || '') if (newRemark === undefined) { diff --git a/src/puppet-web/bridge.ts b/src/puppet-web/bridge.ts index 87b925b43ad9fd3c4b0846a9b90885275f2ee89e..2096202f13b8f5722693bcaeffa47d32c6b3d85b 100644 --- a/src/puppet-web/bridge.ts +++ b/src/puppet-web/bridge.ts @@ -134,7 +134,7 @@ export class Bridge { } } - public async contactRemark(contactId: string, remark: string): Promise { + public async contactRemark(contactId: string, remark: string|null): Promise { try { return await this.proxyWechaty('contactRemarkAsync', contactId, remark) } catch (e) { diff --git a/src/puppet-web/puppet-web.ts b/src/puppet-web/puppet-web.ts index 01fd2f364ae3625dac9a234bef3641c18f15f139..f4035bfc237222401a66d194d755d5720a74c260 100644 --- a/src/puppet-web/puppet-web.ts +++ b/src/puppet-web/puppet-web.ts @@ -368,7 +368,7 @@ export class PuppetWeb extends Puppet { } } - public async contactRemark(contact: Contact, remark: string): Promise { + public async contactRemark(contact: Contact, remark: string|null): Promise { try { const ret = await this.bridge.contactRemark(contact.id, remark) if (!ret) { diff --git a/src/puppet.ts b/src/puppet.ts index b9df26e845fa8eb6932e55e16716cb394a398246..e7dec7b5292b3e2e7c24ee08173e192fcd97e455 100644 --- a/src/puppet.ts +++ b/src/puppet.ts @@ -67,5 +67,5 @@ export abstract class Puppet extends EventEmitter implements Sayable { * Contact */ public abstract contactFind(filterFunc: string): Promise - public abstract contactRemark(contact: Contact, remark: string): Promise + public abstract contactRemark(contact: Contact, remark: string|null): Promise }