Skip to content

Commit

Permalink
Merge branch 'dev' into feat/vcard
Browse files Browse the repository at this point in the history
  • Loading branch information
Rpeche-pk authored Jan 29, 2024
2 parents 2fad66c + 3799774 commit 514eb2b
Show file tree
Hide file tree
Showing 22 changed files with 372 additions and 116 deletions.
98 changes: 98 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,104 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.1.36](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.25...v0.1.36) (2024-01-22)


### Features

* :art: next-version ([70d75ed](https://github.com/leifermendez/bot-whatsapp/commit/70d75edf8265be83a19259091ef98de5bbf56639))
* :art: update + endflow default ([bdf4206](https://github.com/leifermendez/bot-whatsapp/commit/bdf420602b6dc596383f960df26bdce37a2b109f))
* :fire: delay -> `flowDynamic` ([cb6d11b](https://github.com/leifermendez/bot-whatsapp/commit/cb6d11b3242d9ed8ea42d25e457123c52992c8b1))
* :fire: delay -> `flowDynamic` ([8c23eae](https://github.com/leifermendez/bot-whatsapp/commit/8c23eaee69b117e6be276c48b96946cf512b8c33))
* :zap: beta new features ([c34b207](https://github.com/leifermendez/bot-whatsapp/commit/c34b207e3fbb38130b036ba960d07600e606573f))
* :zap: idle concat ([2d23d39](https://github.com/leifermendez/bot-whatsapp/commit/2d23d3907283cf2d64e0f004d9177810dcf787d9))
* :zap: lot improvments ([2a1726b](https://github.com/leifermendez/bot-whatsapp/commit/2a1726bc41862e360e5066ac9ab7ed8dd17cb7c0))
* :zap: lot improvments ([21a0730](https://github.com/leifermendez/bot-whatsapp/commit/21a0730c12bb8ffdd2d79a9c7cf5cbdfc5d5cb50))
* :zap: queue by from ([8b43036](https://github.com/leifermendez/bot-whatsapp/commit/8b43036d85ba5bed3803d524ca71fc97886d66b1))
* **adapter:** :zap: added that it automatically generates the date when the data is added to the db ([889cbfa](https://github.com/leifermendez/bot-whatsapp/commit/889cbfab8abfb76ed8e111e702bdad93483ae611))
* add eslint-plugin ([2df14e6](https://github.com/leifermendez/bot-whatsapp/commit/2df14e6f8923a4e640cf06ff8a83c50095a40e79))
* add eslint-plugin ([5ca3313](https://github.com/leifermendez/bot-whatsapp/commit/5ca331334388c6bd59827a4cd3f5f9ecc5f8e22e))
* add eslint-plugin ([769b7e8](https://github.com/leifermendez/bot-whatsapp/commit/769b7e812b9f47c5375b1e04ad0a35f2441380a3))
* **bot:** :sparkles: feat ([589f96e](https://github.com/leifermendez/bot-whatsapp/commit/589f96efc26d03d622c85619656757f3dfb8c39e))
* **bot:** :zap: add dynamic BlackList ([5a05414](https://github.com/leifermendez/bot-whatsapp/commit/5a054146b6a46cbe7e4a36865425eb0f8209eaf6))
* **bot:** :zap: handler state ctx ([7f3f156](https://github.com/leifermendez/bot-whatsapp/commit/7f3f156c0c05c5f638ed521cb20613aa2243e863))
* **bot:** :zap: idle feature ([e2a6cbd](https://github.com/leifermendez/bot-whatsapp/commit/e2a6cbd7091544907a4c6e5911ea351c4d1d8a42))
* **database:** Se agrego sp para guardar y actualizar contactos en postgres ([574b0d3](https://github.com/leifermendez/bot-whatsapp/commit/574b0d35d1306c935ccb6490018e7c8dfbb73bbe))
* fix gotoFlow addAction ([4ce4dbf](https://github.com/leifermendez/bot-whatsapp/commit/4ce4dbff0e23422cd4c82777b25de0b758b960be))
* idle state ([a39c9d2](https://github.com/leifermendez/bot-whatsapp/commit/a39c9d2c954f167eb8768e4787d440b33cf4f7d0))
* Integrate 'capture_only_intended' flag for silent execution in 'addAnswer' function ([e298b54](https://github.com/leifermendez/bot-whatsapp/commit/e298b546f4e91c2142ca09f4281a0faf694bfa7b))
* meta add fileUrl image ([7b5f8fd](https://github.com/leifermendez/bot-whatsapp/commit/7b5f8fd9577ffb26feeaa670a5bfca84281b20e8))
* next release ([158849f](https://github.com/leifermendez/bot-whatsapp/commit/158849fe99a80096719e09f348ba66d10c97d183))
* next-release ([3f50a05](https://github.com/leifermendez/bot-whatsapp/commit/3f50a0577b82c493ae3b6c85af26e9f2f63b34c7))
* **provider:** :fire: add tmp file twilio ([c99ab6c](https://github.com/leifermendez/bot-whatsapp/commit/c99ab6c6ea5a69790b3229a9700fea1a0d45d222))
* **provider:** :memo: se actualizó el contexto (ctx) para incluir la url ([043b33c](https://github.com/leifermendez/bot-whatsapp/commit/043b33c860c489fed0b5251d06535cea42b75b01))
* **provider:** :sparkles: the image, video, document, stickers, location and vcard events are added ([0705aeb](https://github.com/leifermendez/bot-whatsapp/commit/0705aeb6077fd151ccf7a37582f7afe64e089b36))
* **provider:** :zap: meta fix ([dd849d6](https://github.com/leifermendez/bot-whatsapp/commit/dd849d63571bcd896d9cf9e47eee02dff784558f))
* **provider:** :zap: meta fix ([f50acf2](https://github.com/leifermendez/bot-whatsapp/commit/f50acf2975fe5adb9bdb090f8bd6c056e171f3cb))
* **provider:** ✨ WPPConnect added poll ([564d6bb](https://github.com/leifermendez/bot-whatsapp/commit/564d6bb31b972f2fdd559a1379cc54e64468e8fd))
* **provider:** ✨Baileys added auth with Pairing Code ([a2622cc](https://github.com/leifermendez/bot-whatsapp/commit/a2622cc3a7388138034bd41722f812e552dfbf53))
* **provider:** ✨Baileys added polls in baileys ([6374503](https://github.com/leifermendez/bot-whatsapp/commit/637450351baf32395c719d7a09d47ed0ef3e1fa1))
* se adiciona la funcionalidad de enviar reacciones para el proveedor meta sendReaction ([abf89ff](https://github.com/leifermendez/bot-whatsapp/commit/abf89ff9d5f5ca8005fc738fda8d2fb56b044d31))
* se adiciona la funcionalidad de enviar ubicacion para provedor meta ([73f0c69](https://github.com/leifermendez/bot-whatsapp/commit/73f0c6908405a18d3ae87e564ce00d441c92943a))
* se adiciona la funcionalidad de enviar una ubicacion para el proveedor meta ([3f9942b](https://github.com/leifermendez/bot-whatsapp/commit/3f9942b53cd614c5a601f102d3f2ed52752e8acc))


### Bug Fixes

* :art: more ([35d1279](https://github.com/leifermendez/bot-whatsapp/commit/35d12792ec1b692abcc4aeedb0c7d640b776ee6b))
* :art: pnpm ([122a7e1](https://github.com/leifermendez/bot-whatsapp/commit/122a7e1ab6b0288accba620f410ee7920ed3ff5d))
* :art: pnpm ([bca9826](https://github.com/leifermendez/bot-whatsapp/commit/bca98268f84f033f8bb64d9146d7ccadea39a50c))
* :art: working gotoFlow and capture ([baa7429](https://github.com/leifermendez/bot-whatsapp/commit/baa7429c73675c673850666fc58f0036cac8e66d))
* :zap: bug ([28b3240](https://github.com/leifermendez/bot-whatsapp/commit/28b3240d4f1313356da393832fe616b9f06baa7d))
* :zap: change quueu ([f43c236](https://github.com/leifermendez/bot-whatsapp/commit/f43c2363d5d6df49b16ba9a1f0c6643e9970c622))
* :zap: core properties ([cff223b](https://github.com/leifermendez/bot-whatsapp/commit/cff223ba5839b961fea10316269d16a7b4c39a54))
* :zap: delay after gotoFlow [#877](https://github.com/leifermendez/bot-whatsapp/issues/877) ([1eda39a](https://github.com/leifermendez/bot-whatsapp/commit/1eda39aa7756d7a8f62050775ded20709ad5faad))
* :zap: issue [#865](https://github.com/leifermendez/bot-whatsapp/issues/865) ([2fe6bd5](https://github.com/leifermendez/bot-whatsapp/commit/2fe6bd569791f3481183bc9000145f9f48b07673))
* :zap: issue [#910](https://github.com/leifermendez/bot-whatsapp/issues/910) ([6edf373](https://github.com/leifermendez/bot-whatsapp/commit/6edf3730e143c58b3bb36e1d748a6730e6392168))
* :zap: meta video ([6cef90a](https://github.com/leifermendez/bot-whatsapp/commit/6cef90ad21913634ac3a50e5096eac8242645268))
* :zap: next version ([fbce48f](https://github.com/leifermendez/bot-whatsapp/commit/fbce48f91c76ef44b87a10f60cd922a35fafb45e))
* :zap: other queue ([54ad1d6](https://github.com/leifermendez/bot-whatsapp/commit/54ad1d65826ac78bd5da7e863bd56baafbeff362))
* :zap: prevent queued process ([bbd744b](https://github.com/leifermendez/bot-whatsapp/commit/bbd744b09ee27692ac87888695c54b9ced02a410))
* :zap: queue ([c380f06](https://github.com/leifermendez/bot-whatsapp/commit/c380f061926983a953b0f297f38003b98f02133a))
* :zap: some ([d2d1409](https://github.com/leifermendez/bot-whatsapp/commit/d2d140993a2a4a6be6d55e8de7300decaf2613ab))
* "provider twilio media & document " ([c3b2738](https://github.com/leifermendez/bot-whatsapp/commit/c3b273843afa0141e78e662fe1534f83287bc6e6))
* **bot:** :fire: fix ([894edde](https://github.com/leifermendez/bot-whatsapp/commit/894eddefe161e7c87f049faa40e91ec1bc649a3f))
* **bot:** :fire: se incorpora la funcionalidad de blacklist dinámica ([966834e](https://github.com/leifermendez/bot-whatsapp/commit/966834eb54967348fbb0bb88653add8c968ad121))
* **bot:** :zap: hot fix `fotoFlow` and download ([dced080](https://github.com/leifermendez/bot-whatsapp/commit/dced08017c823791131a29ef4a5e81090800794c))
* crypto url ([f8ff35e](https://github.com/leifermendez/bot-whatsapp/commit/f8ff35e401510e1614e6d6753b7ad42f5114fc16))
* **database:** MySQL conection timeout ([8391037](https://github.com/leifermendez/bot-whatsapp/commit/8391037ff120265faeaa7277918b856d94294ff7))
* default endFlow ([a522eeb](https://github.com/leifermendez/bot-whatsapp/commit/a522eeb2e92ed8c26ee4930e824ef95b7f863d2f))
* fix ([085761a](https://github.com/leifermendez/bot-whatsapp/commit/085761abccac0647a05522d1373ff5c0da96f5f8))
* fix ([a1eb16a](https://github.com/leifermendez/bot-whatsapp/commit/a1eb16a94689f30e0864f0f13f41c057b304d4d5))
* fix twilio ([e122f67](https://github.com/leifermendez/bot-whatsapp/commit/e122f67751f49563dc2d0ea894da1da30dfa03e1))
* fix twilio ([22112a3](https://github.com/leifermendez/bot-whatsapp/commit/22112a364d325aaa03b9ec27c438796cfb832e46))
* fix twilio ([d9ff81c](https://github.com/leifermendez/bot-whatsapp/commit/d9ff81c539e2786fe1210bbd24f2c1da12d90058))
* gloalState ([491e1f7](https://github.com/leifermendez/bot-whatsapp/commit/491e1f72974ce45f8d9a00145f3afb8dbe0e2189))
* **hook:** :zap: event action ([e922dfc](https://github.com/leifermendez/bot-whatsapp/commit/e922dfce84a84a3c3ad00be6aa4e7758459e32bf))
* idle ([07dd0fe](https://github.com/leifermendez/bot-whatsapp/commit/07dd0fe6dac2d18664e7b93e886dd7f5897e4e46))
* idle second version ([79aa5e8](https://github.com/leifermendez/bot-whatsapp/commit/79aa5e8fdc1fff1d1e2b1d7590d3530b13bb31df))
* idle second version ([924d029](https://github.com/leifermendez/bot-whatsapp/commit/924d029e0fcfe8eff5a26d0477343452f0a25204))
* idle second version ([1f8f23c](https://github.com/leifermendez/bot-whatsapp/commit/1f8f23cbe26b91953d305ccc1bead6e7bf6a9b6f))
* **io:** flow.Class some regular expressions don´t works ([a66d219](https://github.com/leifermendez/bot-whatsapp/commit/a66d2197432411634aebd0a1c31c900f731f625f))
* **provider:** :bug: Fixed Puppeteer configuration ([f01bc76](https://github.com/leifermendez/bot-whatsapp/commit/f01bc76edababe8f57aced85db22f567477caf78))
* **provider:** :fire: ([82d05aa](https://github.com/leifermendez/bot-whatsapp/commit/82d05aaad93bdba63cde3c7625b3b64274081ffc))
* **provider:** :zap: change Bailey ([110a4b8](https://github.com/leifermendez/bot-whatsapp/commit/110a4b8d5fc25f2c11ea05c9d33d728830446fcc))
* **provider:** :zap: change Bailey ([5d000af](https://github.com/leifermendez/bot-whatsapp/commit/5d000af98ff6a70613be7019dcfc9c638ea3d9aa))
* **provider:** :zap: update GetMediaUrl and add audio url ([29a4f82](https://github.com/leifermendez/bot-whatsapp/commit/29a4f82b4beae705910d9cb1604b041e3169505a))
* **provider:** :zap: version is added ([d4818f2](https://github.com/leifermendez/bot-whatsapp/commit/d4818f289d7e559fa46076c34c6ddfb1deaf427d))
* **provider:** 🐛Fixed Baileys body Undefined sometimes ([8f90ee8](https://github.com/leifermendez/bot-whatsapp/commit/8f90ee8f2d8ccb396423af375819431ca772e486))
* **provider:** 🐛Fixed get data mysql for baileys ([0f792da](https://github.com/leifermendez/bot-whatsapp/commit/0f792da5bdc668e82b31a061204ca1756614196d))
* **provider:** 🐛Fixed get state message poll ([260c240](https://github.com/leifermendez/bot-whatsapp/commit/260c2406fc31fe8bacaa542dbc959e4618b82273))
* **provider:** 🐛Fixed update version whatsapp-web.js ([464b34f](https://github.com/leifermendez/bot-whatsapp/commit/464b34f2e35d6cb7cdd0426179aec8f961d44f9c))
* **provider:** meta improved 🔥 ([2f21dfd](https://github.com/leifermendez/bot-whatsapp/commit/2f21dfd2b9092736a190a0a1ce4a4fa3762999e0))
* queue new ([e708dd9](https://github.com/leifermendez/bot-whatsapp/commit/e708dd9519b93cc0fd282800a78375224a6261da))
* queue timer clear ([215ccfe](https://github.com/leifermendez/bot-whatsapp/commit/215ccfee6af38d54ada7636a2de59b13e667672c))
* queue timer clear ([dab9e51](https://github.com/leifermendez/bot-whatsapp/commit/dab9e51a3b087cb6586f5fbdce0425979cc473f7))
* release alpha ([99dba85](https://github.com/leifermendez/bot-whatsapp/commit/99dba8547024158ebaca76bb3d42b99dbbbc9897))
* remove map ([e13f912](https://github.com/leifermendez/bot-whatsapp/commit/e13f9127c5c016192f98ef6d8aa923ea08755e23))
* se soluciona problemas con sendContacts para el provider meta ([3bcbb97](https://github.com/leifermendez/bot-whatsapp/commit/3bcbb97979ccc144bc52e5edb5f74e3826909987))
* some fix ([be07912](https://github.com/leifermendez/bot-whatsapp/commit/be079123587a50f490fd7b8addbd48bb528dfb6d))

### [0.1.27](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.25...v0.1.27) (2023-05-28)


Expand Down
9 changes: 5 additions & 4 deletions __test__/0.2.1-case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ suiteCase(`Prevenir enviar mensaje luego de inactividad (2seg)`, async ({ databa
const flujoPrincipal = addKeyword(['hola'])
.addAnswer(
'debes de responder antes de que transcurran 2 segundos (2000)',
{ capture: true, idle: 2000 },
{ capture: true, idle: 2000, ref: '000000000000000000000000' },
async (ctx, { gotoFlow, inRef }) => {
if (ctx?.idleFallBack) {
console.log('me executo ????')
return gotoFlow(flujoFinal)
}
}
)
.addAnswer('gracias!')
.addAnswer('gracias!', { ref: '1111111111111' })

await createBot({
database,
Expand Down Expand Up @@ -87,7 +88,7 @@ suiteCase(`Enviar mensajes con ambos casos de idle`, async ({ database, provider
await flowDynamic(`Empezemos de nuevo.`)
await flowDynamic(`Cual es el numero de orden? tienes dos segundos para responder...`)
})
.addAction({ capture: true, idle: 2000, ref: '🙉🙉🙉🙉🙉🙉🙉🙉' }, async (ctx, { flowDynamic }) => {
.addAction({ capture: true, idle: 2100, ref: '🙉🙉🙉🙉🙉🙉🙉🙉' }, async (ctx, { flowDynamic }) => {
if (ctx?.idleFallBack) {
console.log(`[seundo desvio]`)
console.log(`[idleFallBack]:`, ctx)
Expand Down Expand Up @@ -125,7 +126,7 @@ suiteCase(`Enviar mensajes con ambos casos de idle`, async ({ database, provider
body: 'el numero es 444',
})

await delay(10000)
await delay(15000)

const getHistory = database.listHistory.map((i) => i.answer)
assert.is('Hola tienes 2 segundos para responder si no te pedire de nuevo otro dato', getHistory[0])
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/root",
"version": "0.1.34",
"version": "0.1.37",
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
"main": "app.js",
"private": true,
Expand All @@ -24,7 +24,7 @@
"build:full": "pnpm run build:portal-web && pnpm run cli:rollup && pnpm run bot:rollup && pnpm run provider:rollup && pnpm run database:rollup && pnpm run contexts:rollup && pnpm run create-bot-whatsapp:rollup && pnpm run eslint-plugin:rollup && pnpm run portal:rollup",
"build": "pnpm run cli:rollup && pnpm run bot:rollup && pnpm run provider:rollup && pnpm run database:rollup && pnpm run contexts:rollup && pnpm run create-bot-whatsapp:rollup && pnpm run portal:rollup && pnpm run eslint-plugin:rollup",
"copy.lib": "node ./scripts/move.js",
"test.unit": "node ./node_modules/uvu/bin.js packages test",
"test.unit": "node ./node_modules/uvu/bin.js packages test -i database-json",
"test.e2e": "node ./node_modules/uvu/bin.js __test__ ",
"test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit",
"test": "npm run test.coverage",
Expand Down
31 changes: 28 additions & 3 deletions packages/bot/context/idleState.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
class IdleState {
indexCb = new Map()

/**
*
* @param param0
*/
setIdleTime = ({ from, inRef, timeInSeconds, cb }) => {
cb = cb ?? (() => {})
const startTime = new Date().getTime()
const endTime = startTime + timeInSeconds * 1000

Expand All @@ -24,21 +29,41 @@ class IdleState {
inRef,
cb,
stop: (ctxInComming) => {
cb({ ...ctxInComming, next: false, inRef })
clearInterval(interval)
cb({ ...ctxInComming, next: false, inRef })
},
})
}

/**
*
* @param param0
* @returns
*/
get = ({ from, inRef }) => {
try {
const queueCb = this.indexCb.get(from) ?? []
const isHas = queueCb.findIndex((i) => i.inRef !== inRef) !== -1
return isHas
} catch (err) {
console.error(`Error Get ctxInComming: `, err)
return null
}
}

/**
*
* @param ctxInComming
*/
stop = (ctxInComming) => {
try {
const queueCb = this.indexCb.get(ctxInComming.from) ?? []
for (const iterator of queueCb) {
iterator.stop(ctxInComming)
}
this.indexCb.set(ctxInComming.from, [])
} catch (err) {
console.log(err)
return null
console.error(err)
}
}
}
Expand Down
Loading

0 comments on commit 514eb2b

Please sign in to comment.