Moving message type to types.ts
This commit is contained in:
parent
d620d3cc61
commit
dc117ba02f
@ -1,32 +1,7 @@
|
|||||||
const members = require('./members.js')
|
const { Message } = require('./types')
|
||||||
const got = require('got')
|
const got = require('got')
|
||||||
const $ = require('jquery')
|
const $ = require('jquery')
|
||||||
|
|
||||||
class Message {
|
|
||||||
|
|
||||||
static TYPES = ['text', 'jpeg', 'png', 'webm', 'mp4']
|
|
||||||
|
|
||||||
constructor(id, time, content, type, uid, uname, cid) {
|
|
||||||
this.id = id
|
|
||||||
this.time = time
|
|
||||||
this.uid = uid
|
|
||||||
this.uname = uname
|
|
||||||
this.cid = cid
|
|
||||||
|
|
||||||
this.type = type
|
|
||||||
|
|
||||||
// basically throw away the content since its not valid and we don't
|
|
||||||
// bother dealing with invalid data
|
|
||||||
if(Message.TYPES.indexOf(type) == -1) {
|
|
||||||
this.content = null
|
|
||||||
} else {
|
|
||||||
this.content = content
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
exports.Message = Message
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} auth.jwt | jwt for quick auth
|
* @param {String} auth.jwt | jwt for quick auth
|
||||||
@ -123,3 +98,7 @@ exports.recent_messages = async function (auth, server, channel, start_time, end
|
|||||||
push_message(message)
|
push_message(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.send = async function() {
|
||||||
|
console.log('todo')
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user