This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const htmlCreator = require('html-creator') | |
let filename = 'testdata.json' // insert name of exported json here | |
let raw = fs.readFileSync(filename) | |
let rawJson = JSON.parse(raw) | |
let utils = { | |
pass: '<span style="color: green">✔</span>', | |
fail: '<span style="color: red;">❌</span>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send an attachment in a thread | |
// recipient: Url name of recipient, also called vanity (eg: alexandre.rose) | |
// recipientId : Facebook numeric id of recipient. Can be a person or a thread | |
// path : path of the file | |
// callback(err) does not get any data | |
sendAttachment(recipient, recipientId, path, callback) { | |
const recipientUrl = `${this.baseUrl }/t/${ recipient}`; // Your recipient; | |
const utcTimestamp = new Date().getTime(); | |
const localTime = new Date().toLocaleTimeString().replace(/\s+/g, '').toLowerCase(); | |
const messageId = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const flatCache = require('flat-cache') | |
module.exports = class Cache { | |
constructor (name, path, cacheTime = 0) { | |
this.name = name | |
this.path = path | |
this.cache = flatCache.load(name, path) | |
this.expire = cacheTime === 0 ? false : cacheTime * 1000 * 60 |