first GodDaemons group commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
|
||||
export function publishActionReply(redisCnx, options) {
|
||||
const {
|
||||
action,
|
||||
reqid,
|
||||
sender,
|
||||
reply,
|
||||
replyChannel,
|
||||
senderId = 'gps',
|
||||
} = options
|
||||
reply.action = action
|
||||
reply.sender = senderId
|
||||
if(reqid) reply.reqid = reqid
|
||||
const chan = replyChannel.replace(/\[UID\]/g, sender)
|
||||
redisCnx.redisPublish(chan, reply)
|
||||
}
|
||||
|
||||
export function parseAt(payload, fallbackFn) {
|
||||
if(!payload?.at) return(fallbackFn())
|
||||
const t = Date.parse(payload.at)
|
||||
if(Number.isNaN(t)) return(null)
|
||||
return(t / 1000)
|
||||
}
|
||||
Reference in New Issue
Block a user