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

wip...

上级 2f67a023
import {
log,
} from './config'
export class MediaMessage {
constructor() {
const msg = '`MediaMessage` is deprecated. Please use `Message` instead. See: https://github.com/Chatie/wechaty/issues/1164'
log.warn('MediaMessage', msg)
throw new Error(msg)
}
}
export {
Contact,
ContactQueryFilter,
} from './contact'
export {
FriendRequest,
} from './friend-request'
export {
Message,
} from './message'
export {
Puppet,
PuppetEvent,
PuppetOptions,
ScanData,
} from './puppet'
export {
PuppetAccessory,
} from './puppet-accessory'
export {
Room,
RoomMemberQueryName,
RoomMemberQueryFilter,
RoomQueryFilter,
} from './room'
import {
Readable,
} from 'stream'
import Contact from './contact'
import Message from './message'
import Room from './room'
/**
* Meidia Type Message
*
*/
export abstract class MediaMessage extends Message {
/**
* @private
*/
public toString() {
return `MediaMessage<${this.filename()}>`
}
/**
* Get the MediaMessage file extension, etc: `jpg`, `gif`, `pdf`, `word` ..
*
* @returns {string}
* @example
* bot.on('message', async function (m) {
* if (m instanceof MediaMessage) {
* console.log('media message file name extention is: ' + m.ext())
* }
* })
*/
public abstract ext(): string
/**
* return the MIME Type of this MediaMessage
*
*/
public abstract mimeType(): string | null
/**
* Get the MediaMessage filename, etc: `how to build a chatbot.pdf`..
*
* @returns {string}
* @example
* bot.on('message', async function (m) {
* if (m instanceof MediaMessage) {
* console.log('media message file name is: ' + m.filename())
* }
* })
*/
public abstract filename(): string
/**
* Get the read stream for attachment file
*/
public abstract async readyStream(): Promise<Readable>
public abstract async forward(to: Room | Contact): Promise<void>
}
export default MediaMessage
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册