mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
improve
This commit is contained in:
@@ -25,8 +25,11 @@ const createFlow = (args) => {
|
||||
* @param {*} args
|
||||
* @returns
|
||||
*/
|
||||
const createProvider = (args) => {
|
||||
return new FlowClass(args)
|
||||
const createProvider = (providerClass = class {}) => {
|
||||
const providerInstance = new providerClass()
|
||||
if (!providerClass.prototype instanceof ProviderClass)
|
||||
throw new Error('El provider no implementa ProviderClass')
|
||||
return providerInstance
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@bot-whatsapp/cli": "*",
|
||||
"kleur": "^4.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ const { yellow, bgRed } = require('kleur')
|
||||
const NODE_ENV = process.env.NODE_ENV || 'dev'
|
||||
const printer = (message, title) => {
|
||||
if (NODE_ENV !== 'test') {
|
||||
console.clear()
|
||||
// console.clear()
|
||||
if (title) console.log(bgRed(`${title}`))
|
||||
console.log(
|
||||
yellow(Array.isArray(message) ? message.join('\n') : message)
|
||||
|
||||
Reference in New Issue
Block a user