add module-alias , add image message
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const axios = require('axios')
|
||||
const config = require('../../config')
|
||||
const config = require('@config/index')
|
||||
const qs = require('querystring')
|
||||
|
||||
const queryYoutubeName = async (id = '') => {
|
||||
|
||||
+12
-1
@@ -1,5 +1,5 @@
|
||||
const axios = require('axios')
|
||||
const config = require('../../config')
|
||||
const config = require('@config/index')
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: 'https://api.line.me/v2/bot',
|
||||
@@ -44,6 +44,16 @@ const textObject = (txt = '') => {
|
||||
}
|
||||
}
|
||||
|
||||
const imageObject = (txt = '') => {
|
||||
if (typeof txt !== 'string' || txt.trim().length === 0) return null
|
||||
txt = txt.split(';')
|
||||
return {
|
||||
type: 'image',
|
||||
originalContentUrl: txt[0],
|
||||
previewImageUrl: txt[1]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* send reply message
|
||||
* @param {string} replyToken line message reply token
|
||||
@@ -59,6 +69,7 @@ const replyMessage = async (replyToken, message) => {
|
||||
if (m !== null && m.length > 1) {
|
||||
switch (m[1]) {
|
||||
case 'image':
|
||||
obj = imageObject(message)
|
||||
break
|
||||
case 'text':
|
||||
obj = textObject(message)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const axios = require('axios')
|
||||
const config = require('../../config')
|
||||
const config = require('@config/index')
|
||||
const client = axios.create({
|
||||
baseURL: 'https://api.twitch.tv/helix',
|
||||
headers: {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const pg = require('pg')
|
||||
const config = require('../config')
|
||||
const config = require('@config/index')
|
||||
|
||||
const pool = new pg.Pool({
|
||||
user: config.database.user,
|
||||
@@ -10,4 +10,4 @@ const pool = new pg.Pool({
|
||||
database: config.database.dbname
|
||||
})
|
||||
|
||||
module.exports = pool
|
||||
module.exports = pool
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const api = require('../../../api-action')
|
||||
const DB = require('../../../database')
|
||||
const api = require('@libs/api-action')
|
||||
const DB = require('@libs/database')
|
||||
const axios = require('axios')
|
||||
|
||||
async function run (fn = null, txt, source) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const DB = require('../../database')
|
||||
const DB = require('@libs/database')
|
||||
const actions = require('./actions')
|
||||
|
||||
const parseCMD = async (text = '', source = {}) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const commands = require('./commands')
|
||||
const api = require('../api-action')
|
||||
const api = require('@libs/api-action')
|
||||
|
||||
/**
|
||||
* parse text message object
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const config = require('../../config')
|
||||
const config = require('@config/index')
|
||||
const rawBody = require('raw-body')
|
||||
const crypto = require('crypto')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user