提交 c0fc661c 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

remove deprecated methods (#2049)

上级 d08a1331
...@@ -83,59 +83,59 @@ ...@@ -83,59 +83,59 @@
}, },
"homepage": "https://github.com/wechaty/", "homepage": "https://github.com/wechaty/",
"dependencies": { "dependencies": {
"brolog": "^1.8.3", "brolog": "^1.12.4",
"clone-class": "^0.7.3", "clone-class": "^0.7.3",
"cuid": "^2.1.8", "cuid": "^2.1.8",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"in-gfw": "^1.2.0", "in-gfw": "^1.2.0",
"json-rpc-peer": "^0.15.5", "json-rpc-peer": "^0.16.0",
"npm-programmatic": "0.0.12", "npm-programmatic": "0.0.12",
"open-graph": "^0.2.4", "open-graph": "^0.2.4",
"opencollective": "^1.0.3", "opencollective": "^1.0.3",
"opencollective-postinstall": "^2.0.2", "opencollective-postinstall": "^2.0.3",
"pkg-dir": "^4.2.0", "pkg-dir": "^4.2.0",
"portfinder": "^1.0.25", "portfinder": "^1.0.28",
"promise-retry": "^1.1.1", "promise-retry": "^2.0.1",
"raven": "^2.6.4", "raven": "^2.6.4",
"read-pkg-up": "^7.0.1", "read-pkg-up": "^7.0.1",
"state-switch": "^0.9.9", "state-switch": "^0.9.9",
"typed-emitter": "^1.2.0", "typed-emitter": "^1.3.0",
"watchdog": "^0.8.17", "watchdog": "^0.8.17",
"wechaty-puppet-hostie": "^0.9.13", "wechaty-puppet-hostie": "^0.9.13",
"wechaty-puppet": "^0.31.5", "wechaty-puppet": "^0.32.3",
"ws": "^7.2.3" "ws": "^7.3.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.7", "@babel/core": "^7.11.4",
"@babel/node": "^7.8.7", "@babel/node": "^7.10.5",
"@babel/preset-env": "^7.8.7", "@babel/preset-env": "^7.11.0",
"@chatie/eslint-config": "^0.11.5", "@chatie/eslint-config": "^0.12.1",
"@chatie/git-scripts": "^0.5.2", "@chatie/git-scripts": "^0.6.2",
"@chatie/semver": "^0.4.7", "@chatie/semver": "^0.4.7",
"@chatie/tsconfig": "^0.8.0", "@chatie/tsconfig": "^0.10.1",
"@types/cuid": "^1.3.0", "@types/cuid": "^1.3.1",
"@types/dotenv": "^8.2.0", "@types/dotenv": "^8.2.0",
"@types/glob": "^7.1.1", "@types/glob": "^7.1.3",
"@types/open-graph": "^0.2.0", "@types/open-graph": "^0.2.0",
"@types/promise-retry": "^1.1.3", "@types/promise-retry": "^1.1.3",
"@types/raven": "^2.5.3", "@types/raven": "^2.5.3",
"@types/retry": "^0.12.0", "@types/retry": "^0.12.0",
"@types/ws": "^7.2.2", "@types/ws": "^7.2.6",
"apiai": "^4.0.3", "apiai": "^4.0.3",
"check-node-version": "^4.0.2", "check-node-version": "^4.0.3",
"coveralls": "^3.0.9", "coveralls": "^3.1.0",
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"finis": "^0.4.4", "finis": "^0.4.4",
"glob": "^7.1.6", "glob": "^7.1.6",
"jsdoc-to-markdown": "^5.0.3", "jsdoc-to-markdown": "^6.0.1",
"markdownlint-cli": "^0.22.0", "markdownlint-cli": "^0.23.2",
"nyc": "^15.0.0", "nyc": "^15.1.0",
"pkg-jq": "^0.2.4", "pkg-jq": "^0.2.4",
"qrcode-terminal": "^0.12.0", "qrcode-terminal": "^0.12.0",
"shx": "^0.3.2", "shx": "^0.3.2",
"sloc": "^0.2.1", "sloc": "^0.2.1",
"tstest": "^0.4.10", "tstest": "^0.4.10",
"typedoc": "^0.16.11", "typedoc": "^0.18.0",
"wechaty-puppet-mock": "^0.27.2" "wechaty-puppet-mock": "^0.27.2"
}, },
"files_comment__whitelist_npm_publish": "http://stackoverflow.com/a/8617868/1123955", "files_comment__whitelist_npm_publish": "http://stackoverflow.com/a/8617868/1123955",
......
...@@ -570,7 +570,7 @@ class Contact extends ContactEventEmitter implements Sayable { ...@@ -570,7 +570,7 @@ class Contact extends ContactEventEmitter implements Sayable {
} }
if (typeof phoneList === 'undefined') { if (typeof phoneList === 'undefined') {
return this.wechaty.puppet.contactPhone(this.id) return this.payload.phone
} }
try { try {
...@@ -583,20 +583,6 @@ class Contact extends ContactEventEmitter implements Sayable { ...@@ -583,20 +583,6 @@ class Contact extends ContactEventEmitter implements Sayable {
} }
} }
/**
*
* @description
* Should use {@link Contact#friend} instead
*
* @deprecated
* @ignore
*/
public stranger (): null | boolean {
log.warn('Contact', 'stranger() DEPRECATED. use friend() instead.')
if (!this.payload) return null
return !this.friend()
}
/** /**
* Check if contact is friend * Check if contact is friend
* *
...@@ -618,33 +604,6 @@ class Contact extends ContactEventEmitter implements Sayable { ...@@ -618,33 +604,6 @@ class Contact extends ContactEventEmitter implements Sayable {
return this.payload.friend || null return this.payload.friend || null
} }
/**
* @ignore
* @see {@link https://github.com/Chatie/webwx-app-tracker/blob/7c59d35c6ea0cff38426a4c5c912a086c4c512b2/formatted/webwxApp.js#L3243|webwxApp.js#L324}
* @see {@link https://github.com/Urinx/WeixinBot/blob/master/README.md|Urinx/WeixinBot/README}
*/
/**
* @description
* Check if it's a official account, should use {@link Contact#type} instead
* @deprecated
* @ignore
*/
public official (): boolean {
log.warn('Contact', 'official() DEPRECATED. use type() instead')
return !!this.payload && (this.payload.type === ContactType.Official)
}
/**
* @description
* Check if it's a personal account, should use {@link Contact#type} instead
* @deprecated
* @ignore
*/
public personal (): boolean {
log.warn('Contact', 'personal() DEPRECATED. use type() instead')
return !!this.payload && this.payload.type === ContactType.Personal
}
/** /**
* Enum for ContactType * Enum for ContactType
* @enum {number} * @enum {number}
...@@ -768,18 +727,6 @@ class Contact extends ContactEventEmitter implements Sayable { ...@@ -768,18 +727,6 @@ class Contact extends ContactEventEmitter implements Sayable {
} }
} }
/**
* @description
* Force reload(re-ready()) data for Contact, use {@link Contact#sync} instead
*
* @deprecated
* @ignore
*/
public refresh (): Promise<void> {
log.warn('Contact', 'refresh() DEPRECATED. use sync() instead.')
return this.sync()
}
/** /**
* Force reload data for Contact, Sync data from low-level API again. * Force reload data for Contact, Sync data from low-level API again.
* *
......
...@@ -105,16 +105,6 @@ class Friendship extends EventEmitter implements Acceptable { ...@@ -105,16 +105,6 @@ class Friendship extends EventEmitter implements Acceptable {
return contact return contact
} }
/**
* @description
* use {@link Friendship#add} instead
* @deprecated
*/
public static async send (contact: Contact, hello: string) {
log.warn('Friendship', 'static send() DEPRECATED, use add() instead.')
return this.add(contact, hello)
}
/** /**
* Send a Friend Request to a `contact` with message `hello`. * Send a Friend Request to a `contact` with message `hello`.
* *
......
...@@ -327,17 +327,6 @@ class Message extends EventEmitter implements Sayable { ...@@ -327,17 +327,6 @@ class Message extends EventEmitter implements Sayable {
return room return room
} }
/**
* @description
* use {@link Message#text} instead
*
* @deprecated
*/
public content (): string {
log.warn('Message', 'content() DEPRECATED. use text() instead.')
return this.text()
}
/** /**
* Get the text content of the message * Get the text content of the message
* *
...@@ -777,17 +766,6 @@ class Message extends EventEmitter implements Sayable { ...@@ -777,17 +766,6 @@ class Message extends EventEmitter implements Sayable {
return textWithoutMention.trim() return textWithoutMention.trim()
} }
/**
* @description
* should use {@link Message#mention} instead
* @deprecated
* @ignore
*/
public async mentioned (): Promise<Contact[]> {
log.warn('Message', 'mentioned() DEPRECATED. use mention() instead.')
return this.mentionList()
}
/** /**
* Check if a message is mention self. * Check if a message is mention self.
* *
...@@ -938,16 +916,6 @@ class Message extends EventEmitter implements Sayable { ...@@ -938,16 +916,6 @@ class Message extends EventEmitter implements Sayable {
return ageSeconds return ageSeconds
} }
/**
* @description
* use {@link Message#toFileBox} instead
* @deprecated
*/
public async file (): Promise<FileBox> {
log.warn('Message', 'file() DEPRECATED. use toFileBox() instead.')
return this.toFileBox()
}
/** /**
* Extract the Media File from the Message, and put it into the FileBox. * Extract the Media File from the Message, and put it into the FileBox.
* > Tips: * > Tips:
......
...@@ -177,36 +177,17 @@ class RoomInvitation implements Acceptable { ...@@ -177,36 +177,17 @@ class RoomInvitation implements Acceptable {
public async topic (): Promise<string> { public async topic (): Promise<string> {
const payload = await this.wechaty.puppet.roomInvitationPayload(this.id) const payload = await this.wechaty.puppet.roomInvitationPayload(this.id)
// roomTopic deprecated. use topic instead:
return payload.topic || payload.topic || '' return payload.topic || payload.topic || ''
} }
/**
* @deprecated: use topic() instead
* @ignore
*/
public async roomTopic (): Promise<string> {
return this.topic()
}
public async memberCount (): Promise<number> { public async memberCount (): Promise<number> {
log.verbose('RoomInvitation', 'memberCount()') log.verbose('RoomInvitation', 'memberCount()')
const payload = await this.wechaty.puppet.roomInvitationPayload(this.id) const payload = await this.wechaty.puppet.roomInvitationPayload(this.id)
// roomMemberCount deprecated. use memberCount instead:
return payload.memberCount || payload.memberCount || 0 return payload.memberCount || payload.memberCount || 0
} }
/**
* @deprecated: use memberCount() instead
* @ignore
*/
public async roomMemberCount (): Promise<number> {
log.warn('RoomInvitation', 'roomMemberCount() DEPRECATED. use memberCount() instead.')
return this.memberCount()
}
/** /**
* List of Room Members that you known(is friend) * List of Room Members that you known(is friend)
* @ignore * @ignore
...@@ -216,7 +197,6 @@ class RoomInvitation implements Acceptable { ...@@ -216,7 +197,6 @@ class RoomInvitation implements Acceptable {
const payload = await this.wechaty.puppet.roomInvitationPayload(this.id) const payload = await this.wechaty.puppet.roomInvitationPayload(this.id)
// roomMemberIdList deprecated. use memberIdList isntead.
const contactIdList = payload.memberIdList || payload.memberIdList || [] const contactIdList = payload.memberIdList || payload.memberIdList || []
const contactList = contactIdList.map( const contactList = contactIdList.map(
...@@ -231,15 +211,6 @@ class RoomInvitation implements Acceptable { ...@@ -231,15 +211,6 @@ class RoomInvitation implements Acceptable {
return contactList return contactList
} }
/**
* @deprecated: use memberList() instead.
* @ignore
*/
public async roomMemberList (): Promise<Contact[]> {
log.warn('RoomInvitation', 'roomMemberList() DEPRECATED. use memberList() instead.')
return this.roomMemberList()
}
/** /**
* Get the invitation time * Get the invitation time
* *
......
...@@ -302,15 +302,6 @@ class Room extends RoomEventEmitter implements Sayable { ...@@ -302,15 +302,6 @@ class Room extends RoomEventEmitter implements Sayable {
} }
} }
/**
* @ignore
* @ignore
* @deprecated: Use `sync()` instead
*/
public async refresh (): Promise<void> {
await this.sync()
}
/** /**
* Force reload data for Room, Sync data from puppet API again. * Force reload data for Room, Sync data from puppet API again.
* *
...@@ -959,14 +950,6 @@ class Room extends RoomEventEmitter implements Sayable { ...@@ -959,14 +950,6 @@ class Room extends RoomEventEmitter implements Sayable {
} }
} }
/**
* @deprecated: use qrCode() instead
*/
public async qrcode () {
log.warn('Room', 'qrcode() is deprecated. use qrCode() instead.')
return this.qrCode()
}
/** /**
* Get QR Code Value of the Room from the room, which can be used as scan and join the room. * Get QR Code Value of the Room from the room, which can be used as scan and join the room.
* > Tips: * > Tips:
...@@ -1007,18 +990,6 @@ class Room extends RoomEventEmitter implements Sayable { ...@@ -1007,18 +990,6 @@ class Room extends RoomEventEmitter implements Sayable {
return null return null
} }
/**
* Same as function alias
* @param {Contact} contact
* @returns {Promise<string | null>}
* @deprecated: use room.alias() instead
* @ignore
*/
public async roomAlias (contact: Contact): Promise<null | string> {
log.warn('Room', 'roomAlias() DEPRECATED. use room.alias() instead')
return this.alias(contact)
}
/** /**
* Check if the room has member `contact`, the return is a Promise and must be `await`-ed * Check if the room has member `contact`, the return is a Promise and must be `await`-ed
* *
......
...@@ -101,9 +101,6 @@ export interface WechatyOptions { ...@@ -101,9 +101,6 @@ export interface WechatyOptions {
memory? : MemoryCard, memory? : MemoryCard,
name? : string, // Wechaty Name name? : string, // Wechaty Name
// @deprecated: use `name` instead of `profile`
profile? : null | string, // DEPRECATED: use name instead
puppet? : PuppetModuleName | Puppet, // Puppet name or instance puppet? : PuppetModuleName | Puppet, // Puppet name or instance
puppetOptions? : PuppetOptions, // Puppet TOKEN puppetOptions? : PuppetOptions, // Puppet TOKEN
ioToken? : string, // Io TOKEN ioToken? : string, // Io TOKEN
...@@ -287,10 +284,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable { ...@@ -287,10 +284,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
super() super()
log.verbose('Wechaty', 'constructor()') log.verbose('Wechaty', 'constructor()')
if (!options.name && options.profile) {
log.verbose('Wechaty', 'constructor() WechatyOptions.profile DEPRECATED. use WechatyOptions.name instead.')
options.name = options.profile
}
this.memory = this.options.memory this.memory = this.options.memory
this.id = cuid() this.id = cuid()
...@@ -838,17 +831,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable { ...@@ -838,17 +831,6 @@ export class Wechaty extends WechatyEventEmitter implements Sayable {
} }
} }
/**
* @description
* Should use {@link Wechaty#userSelf} instead
* @deprecated Use `userSelf()` instead
* @ignore
*/
public self (): Contact {
log.warn('Wechaty', 'self() DEPRECATED. use userSelf() instead.')
return this.userSelf()
}
/** /**
* Get current user * Get current user
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册