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

remove useless file, add file type

上级 0fdca19f
import PuppetPadchat from './puppet-padchat'
// import Firer from './firer'
import {
PadchatMessagePayload,
// PadchatMessageType,
} from './padchat-schemas'
import {
log,
} from '../config'
/* tslint:disable:variable-name */
export const Event = {
onMessage,
}
async function onMessage(
this : PuppetPadchat,
payload : PadchatMessagePayload,
): Promise<void> {
try {
/**
* Fire Events if match message type & content
*/
// switch (rawPayload.sub_type) {
// // case PadchatMessageType.VERIFYMSG:
// // Firer.checkFriendRequest.call(this, msg)
// // break
// case PadchatMessageType.SYS:
// // if (msg.room()) {
// if (/@chatroom/.test(rawPayload.from_user)) {
// const joinResult = await Firer.checkRoomJoin(rawPayload)
// const leaveResult = await Firer.checkRoomLeave(rawPayload)
// const topicRestul = await Firer.checkRoomTopic(rawPayload)
// if (!joinResult && !leaveResult && !topicRestul) {
// log.warn('PuppetPadchatEvent', `checkRoomSystem message: <${msg.text()}> not found`)
// }
// }
// // else {
// // Firer.checkFriendConfirm.call(this, msg)
// // }
// break
// }
/**
* Check Type for special Message
* reload if needed
*/
// switch (rawPayload.sub_type) {
// case PadchatMessageType.EMOTICON:
// case PadchatMessageType.IMAGE:
// case PadchatMessageType.VIDEO:
// case PadchatMessageType.VOICE:
// case PadchatMessageType.MICROVIDEO:
// case PadchatMessageType.APP:
// log.verbose('PuppetPadchatEvent', 'onMessage() EMOTICON/IMAGE/VIDEO/VOICE/MICROVIDEO message')
// msg = this.Message.create(
// rawPayload.msg_id,
// await this.messagePayload(rawPayload.msg_id),
// )
// break
// case PadchatMessageType.TEXT:
// log.verbose('PuppetPadchatEvent', 'onMessage() (TEXT&LOCATION) message')
// msg = this.Message.create(
// rawPayload.msg_id,
// await this.messagePayload(rawPayload.msg_id),
// )
// }
// await msg.ready()
this.emit('message', payload.msg_id)
} catch (e) {
log.error('PuppetPadchatEvent', 'onMessage() exception: %s', e.stack)
throw e
}
}
export default Event
......@@ -304,6 +304,14 @@ export class PuppetPadchat extends Puppet {
break
case PadchatMessageType.App:
case PadchatMessageType.Emoticon:
case PadchatMessageType.Image:
case PadchatMessageType.MicroVideo:
case PadchatMessageType.Video:
case PadchatMessageType.Voice:
// TODO: the above types are filel type
default:
this.cachePadchatMessagePayload.set(
rawPayload.msg_id,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册