diff options
Diffstat (limited to 'src/instagram_task.ts')
| -rw-r--r-- | src/instagram_task.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/instagram_task.ts b/src/instagram_task.ts index 6ab9838..7ca0c77 100644 --- a/src/instagram_task.ts +++ b/src/instagram_task.ts @@ -1,8 +1,13 @@ -import puppeteer, { Browser, Page, TimeoutError } from "puppeteer"; -import { InstagramTask, addTask } from "./tasks"; import fs from "fs"; +import puppeteer, { TimeoutError } from "puppeteer"; import { wait } from "./utils"; +export interface InstagramTask { + type: "download_instagram"; + url: string; + respondWithFile: (message: string, filePath: string) => Promise<void>; +} + export const runDownloadInstagramTask = async (task: InstagramTask) => { const browser = await puppeteer.launch({ headless: false, @@ -117,12 +122,7 @@ export const runDownloadInstagramTask = async (task: InstagramTask) => { const downloadedFile = downloadedFiles[0]; - addTask({ - type: "slack_reply", - replyId: task.replyId, - message: "Here's the video you requested", - filePath: `./downloads/${downloadedFile}`, - }); + await task.respondWithFile("🗿🗿🗿", `./downloads/${downloadedFile}`); } finally { await page.close(); await browser.close(); |
