diff --git a/apps/tools.js b/apps/tools.js index 6de5f88..92c5caf 100644 --- a/apps/tools.js +++ b/apps/tools.js @@ -507,27 +507,26 @@ export class tools extends plugin { timeout: 10000, proxy: false, }) - .then(resp => { + .then(async resp => { const reg = / { + const addr = `https:${item.split('"')[3]}`; + return axios.get(addr, { + headers: { + "User-Agent": + "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Mobile Safari/537.36", + }, + responseType: "stream", + }) .then(resp => { - const filepath = `${ downloadPath }/${ /com\/(.*)\?/.exec(addr)[1] }.jpg`; + const filepath = `${downloadPath}/${/com\/(.*)\?/.exec(addr)[1]}.jpg`; const writer = fs.createWriteStream(filepath); resp.data.pipe(writer); return new Promise((resolve, reject) => { @@ -535,11 +534,17 @@ export class tools extends plugin { writer.on("error", reject); }); }) - .then(filepath => { - e.reply(segment.image(fs.readFileSync(filepath))); - fs.unlinkSync(filepath); - }); - } + }) + const images = await Promise.all(imagesPath).then(paths => { + return paths.map(item => { + return { + message: segment.image(fs.readFileSync(item)), + nickname: e.sender.card || e.user_id, + user_id: e.user_id, + } + }) + }) + await this.reply(await Bot.makeForwardMsg(images)); }); return true; diff --git a/model/index.js b/model/index.js index 6f35a0d..43feff4 100644 --- a/model/index.js +++ b/model/index.js @@ -60,6 +60,7 @@ class RConfig { const watcher = chokidar.watch(file) watcher.on('change', (path) => { + delete logger.mark(`[修改配置文件][${name}]`) }) }