modify facebook link

This commit is contained in:
Jay 2018-08-28 22:04:50 +08:00
parent 098bcff5a4
commit ac446758b6
2 changed files with 3 additions and 8 deletions

View File

@ -3,7 +3,6 @@ const cron = require('cron')
const DB = require('./libs/database') const DB = require('./libs/database')
const fbParser = require('./libs/facebook-pageparse') const fbParser = require('./libs/facebook-pageparse')
const api = require('./libs/api-action') const api = require('./libs/api-action')
const event = require('./event')
const axios = require('axios') const axios = require('axios')
new cron.CronJob({ // eslint-disable-line new cron.CronJob({ // eslint-disable-line
@ -310,10 +309,6 @@ const checkDonate = async (loginName = null, opayid = null) => {
values values
}) })
let msg = `/me 感謝 ${i.name} 贊助了 ${i.amount} 元, ${i.msg}` let msg = `/me 感謝 ${i.name} 贊助了 ${i.amount} 元, ${i.msg}`
//event.emit('twitchSend', {
// msg,
// channel: loginName
//})
process.send({ process.send({
type: 'twitchSend', type: 'twitchSend',
data: { data: {

View File

@ -19,7 +19,7 @@ const getLastPost = async (pageid = '') => {
console.log('access facebook fan page :::: ' + pageid) console.log('access facebook fan page :::: ' + pageid)
let page = await new Promise((resolve) => { let page = await new Promise((resolve) => {
request({ request({
baseUrl: 'https://facebook.com', baseUrl: 'https://www.facebook.com',
url: `/${encodeURIComponent(pageid)}/posts`, url: `/${encodeURIComponent(pageid)}/posts`,
method: 'get', method: 'get',
headers: { headers: {
@ -95,7 +95,7 @@ const getLastPost = async (pageid = '') => {
return b.time - a.time return b.time - a.time
}) })
let post = posts[0] let post = posts[0]
post.link = `https://facebook.com/${post.link.replace(/^\//, '')}` post.link = `https://www.facebook.com/${post.link.replace(/^\//, '')}`
return post return post
} }