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: {
|
||||
|
||||
Reference in New Issue
Block a user