From 7eba90cd86e7ea89807bd0947fd27cfd5d9692c8 Mon Sep 17 00:00:00 2001 From: "danielcardeenas@gmail.com" Date: Fri, 10 Apr 2020 09:52:26 -0500 Subject: [PATCH] Add cmd user interaction --- src/controllers/browser.ts | 1 + src/controllers/initializer.ts | 3 ++- src/lib/wapi/functions/delete-messages.js | 4 ++-- src/lib/wapi/functions/open-chat.js | 1 + src/lib/wapi/store/store-objects.js | 5 +++++ src/lib/wapi/webpack.config.js | 4 ++-- 6 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/lib/wapi/functions/open-chat.js diff --git a/src/controllers/browser.ts b/src/controllers/browser.ts index 58ac3c30..c199780a 100644 --- a/src/controllers/browser.ts +++ b/src/controllers/browser.ts @@ -4,6 +4,7 @@ import { Browser, Page } from 'puppeteer'; import puppeteer from 'puppeteer-extra'; import { CreateConfig } from '../config/create-config'; import { puppeteerConfig } from '../config/puppeteer.config'; +import chalk = require('chalk'); import StealthPlugin = require('puppeteer-extra-plugin-stealth'); export async function initWhatsapp(session: string, options: CreateConfig) { diff --git a/src/controllers/initializer.ts b/src/controllers/initializer.ts index 12635ad1..1abaeff3 100644 --- a/src/controllers/initializer.ts +++ b/src/controllers/initializer.ts @@ -10,6 +10,7 @@ import boxen = require('boxen'); import Spinnies = require('spinnies'); const { version } = require('../../package.json'); +// Global let updatesChecked = false; /** @@ -54,7 +55,7 @@ export async function create( } if (mergedOptions.logQR) { - console.log(`Scan QR for: ${session}`); + console.log(`Scan QR for: ${session} `); console.log(asciiQR); } diff --git a/src/lib/wapi/functions/delete-messages.js b/src/lib/wapi/functions/delete-messages.js index 58247936..57a30597 100644 --- a/src/lib/wapi/functions/delete-messages.js +++ b/src/lib/wapi/functions/delete-messages.js @@ -6,8 +6,8 @@ * @param {Function} done Optional callback */ export function deleteMessages(chatId, messageArray, onlyLocal, done) { - var userId = new Store.WidFactory.createWid(chatId); - let conversation = WAPI.getChat(userId); + const userId = new Store.WidFactory.createWid(chatId); + const conversation = WAPI.getChat(userId); if (!conversation) { if (done !== undefined) { done(false); diff --git a/src/lib/wapi/functions/open-chat.js b/src/lib/wapi/functions/open-chat.js new file mode 100644 index 00000000..127dd47e --- /dev/null +++ b/src/lib/wapi/functions/open-chat.js @@ -0,0 +1 @@ +export function openChat(chatId) {} diff --git a/src/lib/wapi/store/store-objects.js b/src/lib/wapi/store/store-objects.js index 2f08f07a..5ff784cb 100644 --- a/src/lib/wapi/store/store-objects.js +++ b/src/lib/wapi/store/store-objects.js @@ -251,4 +251,9 @@ export const storeObjects = [ conditions: (module) => module.default && module.default.encryptAndUpload ? module.default : null, }, + { + id: 'Cmd', + conditions: (module) => + module.default && module.default.openChatFromUnread ? module : null, + }, ]; diff --git a/src/lib/wapi/webpack.config.js b/src/lib/wapi/webpack.config.js index 39cbe3a3..fe62c4d7 100644 --- a/src/lib/wapi/webpack.config.js +++ b/src/lib/wapi/webpack.config.js @@ -2,8 +2,8 @@ const path = require('path'); module.exports = { entry: './wapi.js', - // mode: 'development', - // devtool: 'source-map', + mode: 'development', + devtool: 'source-map', output: { path: path.resolve(__dirname, '../../../dist/lib/wapi'), filename: 'wapi.js',