Compare commits
461 Commits
fix/venom
...
feature/br
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c451ad5e68 | ||
| 4b1a43187e | |||
|
|
cb0d0be786 | ||
|
|
28a3a7a5e3 | ||
|
|
737b0b6055 | ||
|
|
bd5a01b7e4 | ||
|
|
3a74927b9d | ||
|
|
31a7b58709 | ||
|
|
acf13fb02f | ||
|
|
21773e244e | ||
|
|
345f626986 | ||
|
|
b72dcd75b7 | ||
|
|
2318a6f1e3 | ||
|
|
9b77b3f148 | ||
|
|
75ec60a1bf | ||
|
|
2c5f3a60b7 | ||
|
|
3cc79a7fd7 | ||
|
|
db7257638a | ||
|
|
59130952fa | ||
|
|
e07e6c5e19 | ||
|
|
190aae55e3 | ||
|
|
15c3747fbf | ||
|
|
d945f0ea79 | ||
|
|
99218b861a | ||
|
|
0feb51cfd0 | ||
|
|
54270c197e | ||
|
|
6940737d49 | ||
| d564c170a7 | |||
| c7117b9884 | |||
|
|
6e10a1084d | ||
|
|
147100dfc2 | ||
|
|
53fe5b2e14 | ||
|
|
ba17e6c72c | ||
|
|
5e95b200cf | ||
|
|
80d3f09480 | ||
|
|
d1b4cbf28b | ||
|
|
3202d45aa8 | ||
|
|
c05de8556f | ||
|
|
81c4ca968e | ||
|
|
ba61b6718d | ||
|
|
665e19fe5b | ||
|
|
7a6274e739 | ||
|
|
f2c8794c48 | ||
|
|
593858bcd2 | ||
|
|
3605f0d1f6 | ||
|
|
f77581fc9d | ||
|
|
b74bc67a94 | ||
|
|
2f9f2169f3 | ||
|
|
0f1c040bb8 | ||
|
|
62c16785a2 | ||
|
|
1d64a6b331 | ||
|
|
ccbf7a7754 | ||
|
|
eaefc734d9 | ||
|
|
8d6c34d8b9 | ||
|
|
77c6baf46b | ||
|
|
022a3b7d8e | ||
|
|
6e8e8090fb | ||
|
|
a3403dfd92 | ||
|
|
4756745200 | ||
|
|
0d07998a9e | ||
|
|
1cbccb0463 | ||
|
|
d84ee56778 | ||
|
|
aa5aa99d7f | ||
|
|
7d22a47408 | ||
|
|
bed4422e44 | ||
|
|
6d6a4aea84 | ||
|
|
d8d7afe3e4 | ||
|
|
7b7ff8da55 | ||
|
|
fdd38dd541 | ||
|
|
5ce9d82c6d | ||
|
|
54d84cd156 | ||
|
|
5ae588e9cb | ||
|
|
8e6d5cd159 | ||
|
|
f7da73050d | ||
|
|
8a7ee09211 | ||
|
|
1ba2219710 | ||
|
|
ae83774365 | ||
|
|
47a59dc989 | ||
| 49e55088c7 | |||
|
|
19fd788c0f | ||
| 445d3ba78c | |||
|
|
3c16f8f501 | ||
|
|
41c911f867 | ||
|
|
93745dcc14 | ||
|
|
b89aebb106 | ||
|
|
a20499bf35 | ||
|
|
d06294a15a | ||
|
|
dcbc070ea5 | ||
|
|
c84fd60237 | ||
|
|
3012e026b7 | ||
|
|
d94034d5bb | ||
| dbf291070e | |||
|
|
9d2f57da76 | ||
|
|
ceda946d78 | ||
|
|
b0fe63e70f | ||
|
|
eabef7a92d | ||
|
|
9afc5b5a00 | ||
|
|
1b878d2ba0 | ||
|
|
fe33c213b1 | ||
|
|
b0b7ea0e1b | ||
|
|
3d197e877e | ||
|
|
08de15d3d8 | ||
|
|
2a1436bf7c | ||
|
|
78b0a9dddc | ||
|
|
77be7ec7fb | ||
|
|
d8309f77e1 | ||
|
|
d49a91308d | ||
|
|
96a993eeb0 | ||
|
|
760586c819 | ||
|
|
3cef741c9e | ||
|
|
d307d2e7a3 | ||
|
|
fe1129e5ff | ||
|
|
57fd3e8aab | ||
|
|
9b087e0710 | ||
|
|
568978c0dc | ||
|
|
45f477e782 | ||
|
|
79f638d01b | ||
|
|
208fb4e913 | ||
|
|
a603e3b7dc | ||
|
|
38e2340782 | ||
|
|
43f870b1bb | ||
|
|
54a59c7f0d | ||
|
|
2850a34ead | ||
|
|
9242a54fc2 | ||
|
|
b0c0510420 | ||
|
|
4dda7c8491 | ||
|
|
0fee32e788 | ||
|
|
ebf53fd79f | ||
|
|
3d639b78f2 | ||
|
|
1c1a1e6954 | ||
|
|
4e1aeacc35 | ||
|
|
4dc65fd519 | ||
|
|
bd952243b7 | ||
|
|
641d9a2519 | ||
|
|
6940d33960 | ||
| 76a4216772 | |||
| ba2291a3dd | |||
|
|
0d6f702ff5 | ||
| 32db429f29 | |||
|
|
b5d8a6d28a | ||
| d04e7322cb | |||
|
|
f5eee8b6f5 | ||
|
|
78fb70bc1a | ||
|
|
99b18617e7 | ||
|
|
6a26aed929 | ||
|
|
bdf8abfca4 | ||
|
|
fa64d4e3fd | ||
|
|
55bef7c4e7 | ||
|
|
04b51046aa | ||
|
|
6b75bd10fa | ||
|
|
1415a3c915 | ||
|
|
a3c2c85d90 | ||
|
|
38cd1593a1 | ||
|
|
815bb9df84 | ||
|
|
b5016c7b98 | ||
|
|
b968d4cba2 | ||
|
|
adda5d8c64 | ||
|
|
f15e34020e | ||
|
|
65afdeb69e | ||
|
|
1a5c591294 | ||
|
|
b5bfeab57c | ||
|
|
c309d4fbda | ||
|
|
8f2734bfaa | ||
|
|
637c13e81c | ||
|
|
3248dce03d | ||
|
|
928365dcaf | ||
|
|
e37f28096c | ||
|
|
ea1c0bf99b | ||
|
|
aff9f19d8e | ||
|
|
3324ebbb7d | ||
|
|
5633f7c71c | ||
|
|
b659cc9b15 | ||
|
|
c42591000a | ||
|
|
eaf6e084c1 | ||
|
|
ee5b69dbf3 | ||
|
|
e0a34d8d8d | ||
|
|
30e4c20669 | ||
|
|
b2f9f7158b | ||
|
|
229e017ae2 | ||
|
|
dacc7af87b | ||
|
|
e54f1fff51 | ||
|
|
cfde8b213c | ||
|
|
7d96a2c8d9 | ||
|
|
e596526762 | ||
|
|
230bfc16eb | ||
|
|
2cbc96245d | ||
|
|
952ce86ffa | ||
|
|
c62af73c16 | ||
|
|
20f665175c | ||
|
|
11c784f882 | ||
|
|
a6f4aa8d1e | ||
|
|
41e95a606d | ||
|
|
33c0fc09d0 | ||
|
|
751ae00df3 | ||
|
|
e17fb93b47 | ||
|
|
5088b9ff1b | ||
|
|
0db9a190cb | ||
|
|
27ad84fc6c | ||
|
|
447e75f97d | ||
|
|
a60c891a86 | ||
|
|
480d96771f | ||
|
|
5c620342a4 | ||
|
|
d39feb78f0 | ||
|
|
3af618d466 | ||
|
|
30f9975738 | ||
|
|
18a59b85cb | ||
|
|
2563e3ed84 | ||
|
|
c382ca3ca2 | ||
|
|
ab7ad81efb | ||
|
|
91cafe5bb9 | ||
|
|
83fb510a39 | ||
|
|
9a0ba42705 | ||
|
|
e8d625201e | ||
|
|
f1addf6746 | ||
|
|
6c50148143 | ||
|
|
8bc233a79a | ||
|
|
4abb29f8db | ||
|
|
1c976f28f0 | ||
|
|
98440bbd16 | ||
|
|
069b59e71d | ||
|
|
96b569766c | ||
|
|
939c9cbae5 | ||
|
|
be39e8fd30 | ||
|
|
279b93b61b | ||
|
|
5b796a163e | ||
|
|
305d957e11 | ||
|
|
54d1f57a54 | ||
|
|
4896284a23 | ||
|
|
5aa348be0d | ||
|
|
846cecdcab | ||
|
|
954e6b3a98 | ||
|
|
b58e0cc048 | ||
|
|
8b3c02d027 | ||
|
|
086c1c3a36 | ||
|
|
edf45774ba | ||
|
|
7f437d0587 | ||
|
|
14c818102c | ||
|
|
8ce5d43d6b | ||
|
|
b6fd8e2632 | ||
|
|
e5efdec31d | ||
|
|
de43077860 | ||
|
|
d7cb5b285e | ||
|
|
21407c0e37 | ||
|
|
484c8c3bde | ||
|
|
6499248983 | ||
|
|
f2137d310d | ||
|
|
69fd81a565 | ||
|
|
d522b03e2e | ||
|
|
e62351bbc8 | ||
|
|
2db0e10626 | ||
|
|
e331c2dcc4 | ||
|
|
eacf5ded69 | ||
|
|
bb7161b8f3 | ||
|
|
3cdff95f0f | ||
|
|
512c923095 | ||
|
|
aa522059bb | ||
|
|
15d06c6674 | ||
|
|
52eacfc8c9 | ||
|
|
78ddf742db | ||
|
|
2d2bb085cd | ||
|
|
9dc1ac5c42 | ||
|
|
3cc386acd4 | ||
|
|
887b0335b4 | ||
|
|
42931ca689 | ||
|
|
c3e44f764b | ||
|
|
8b6a27b0a7 | ||
|
|
e4ed904a8b | ||
|
|
4be1906914 | ||
|
|
eba032b3b8 | ||
|
|
666d689986 | ||
|
|
351e2b97d0 | ||
|
|
7d2aecf369 | ||
|
|
917942139f | ||
|
|
d117bdd463 | ||
|
|
68eee0f36d | ||
|
|
ecf2a16b3d | ||
|
|
eba92299cf | ||
|
|
88ff3a43a0 | ||
|
|
ba02496222 | ||
|
|
c20e151e20 | ||
|
|
2cf7f5e668 | ||
|
|
b336586de3 | ||
|
|
69557968ab | ||
|
|
9223b0dda7 | ||
|
|
146f2ba489 | ||
|
|
6403b83c23 | ||
|
|
0e111b2bb7 | ||
|
|
b2a0b351ee | ||
|
|
5be76e9d2d | ||
|
|
be124cd7a2 | ||
| 377d819038 | |||
|
|
33ad9c7703 | ||
|
|
458fd30178 | ||
| c539fc3788 | |||
| 6656676123 | |||
| 26dbfcdc72 | |||
| a256b78e5f | |||
| 9577aba145 | |||
| 2f30b995e2 | |||
| c410e9763c | |||
|
|
c308834e6d | ||
|
|
748262302c | ||
|
|
111368e9e4 | ||
|
|
70eebe58b9 | ||
|
|
67d47a6630 | ||
|
|
3dcb247ef9 | ||
|
|
15d31d6047 | ||
|
|
65ffbc358d | ||
|
|
0353d0994d | ||
|
|
160adee406 | ||
|
|
5ee5973911 | ||
|
|
331e5b0f8e | ||
|
|
4d8cf623ff | ||
|
|
9885872991 | ||
|
|
d1e2fbc750 | ||
|
|
6aa78233ff | ||
|
|
e9539cab8b | ||
|
|
386c1bbbac | ||
|
|
3bdc7afe80 | ||
|
|
1b23b83746 | ||
|
|
37fe32322e | ||
|
|
9b30e7dcfc | ||
|
|
478929d134 | ||
|
|
16e5d4b176 | ||
|
|
0b4e35308d | ||
|
|
1ec15647dc | ||
|
|
9ad4874fda | ||
|
|
4d34d3ab1d | ||
|
|
772e52358d | ||
|
|
24b59b1ecb | ||
|
|
f200be76f4 | ||
|
|
c344ef3677 | ||
|
|
388f56f183 | ||
|
|
2eab155cc9 | ||
| 3cca0d3d14 | |||
|
|
b62d21a0bf | ||
|
|
0c94647a27 | ||
|
|
2f633c72da | ||
|
|
7d6708c01b | ||
|
|
798f1cebde | ||
|
|
78aa23fab0 | ||
|
|
b6bf43d70f | ||
|
|
d9aa97c781 | ||
|
|
964a074aa4 | ||
|
|
b4aea18b63 | ||
| 4fc3a6332b | |||
| 42a1f6502f | |||
| 50c975c8bd | |||
| aed0f76dfb | |||
|
|
954e751f70 | ||
| b2f1339610 | |||
|
|
1f61e1a8ea | ||
|
|
63aacdbcaf | ||
|
|
290812bf9a | ||
|
|
be3c228e9e | ||
|
|
e585e2f5f6 | ||
|
|
ed36ce0a77 | ||
|
|
bad16943fc | ||
|
|
a21633fb7c | ||
|
|
96e220cd71 | ||
|
|
0e69d894e1 | ||
| 8160d13c86 | |||
| dcf65b87bc | |||
| a8b29ee1ce | |||
| b59d4fcdd7 | |||
| 2f730ae71e | |||
|
|
6c4845d733 | ||
|
|
91bfdc4630 | ||
|
|
ff65832012 | ||
|
|
68dd1820f0 | ||
|
|
663641a1b8 | ||
|
|
694284488d | ||
|
|
9f8693d63d | ||
|
|
21ec4d1bdd | ||
|
|
bf07c664d1 | ||
|
|
c7e56a4b13 | ||
| fc56c3f042 | |||
|
|
4ec6f1e120 | ||
|
|
1032a3b769 | ||
| cc809368f0 | |||
|
|
6051da99c8 | ||
|
|
942d7e539a | ||
|
|
85f50be9dc | ||
|
|
a52aaa11d8 | ||
|
|
5b15527d78 | ||
|
|
25fc864f66 | ||
| 0581d63942 | |||
|
|
83c247377a | ||
|
|
032dc384b7 | ||
|
|
e3cbf6af01 | ||
|
|
188ff4fb7d | ||
|
|
73e079e93a | ||
|
|
911965b48e | ||
|
|
186477f04d | ||
|
|
2b13d58077 | ||
| 4e0a1091ee | |||
|
|
a7d4103eb3 | ||
|
|
8328f5a078 | ||
|
|
7e5533e46e | ||
|
|
b041f7d0c7 | ||
|
|
3842bb6889 | ||
|
|
71d43b585a | ||
|
|
438607c222 | ||
| e79b881297 | |||
| 99f508f938 | |||
|
|
b7e1ae534a | ||
|
|
77af8f9488 | ||
|
|
dabb0cf131 | ||
|
|
55985083ec | ||
|
|
1fa234c870 | ||
|
|
7890eae03a | ||
|
|
a80225f40e | ||
|
|
467cd23457 | ||
|
|
407e9065e7 | ||
|
|
5433610a84 | ||
|
|
a42b6f4af8 | ||
|
|
fbaef0f60c | ||
|
|
342cbccff1 | ||
| 663f20cc43 | |||
|
|
73671b26ef | ||
|
|
06acec2bf2 | ||
|
|
c868f73462 | ||
|
|
93a990e229 | ||
|
|
00c587fbf2 | ||
|
|
e6fefb4049 | ||
|
|
2d5ac2664b | ||
|
|
4d4f15ce73 | ||
|
|
a30eaac775 | ||
|
|
5da4b7a4d1 | ||
|
|
4e0fcbd834 | ||
|
|
e37fd0da36 | ||
|
|
b8ea8283eb | ||
|
|
3e0781fde6 | ||
|
|
f50658c0ba | ||
|
|
4819dfebda | ||
|
|
25fb0d6ece | ||
|
|
29fd94a0e1 | ||
|
|
851052b3d2 | ||
|
|
a43444bb3e | ||
|
|
c2a6c6872d | ||
| d5a614e5f8 | |||
| c97a172b34 | |||
|
|
23b2e8e439 | ||
|
|
f0a0bacec9 | ||
|
|
ec32dc429f | ||
|
|
5303dd7d25 | ||
|
|
0246fc0b91 | ||
|
|
2858e910dc | ||
|
|
33490dc737 | ||
|
|
b3b458e41c | ||
|
|
e8aed880d8 | ||
|
|
babff11c70 | ||
|
|
b24c005e3e | ||
|
|
2d6c1879ce | ||
|
|
f88607c2c2 | ||
|
|
b3c13d5f98 | ||
|
|
ee87e9e875 | ||
|
|
1884832192 | ||
|
|
f21a58b6ff | ||
|
|
8a4f134327 | ||
|
|
9b6ce92612 |
7
.github/FUNDING.yml
vendored
@@ -1,9 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: leifermendez
|
||||
open_collective: bot-whatsapp
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
patreon: leifermendez
|
||||
custom: https://www.buymeacoffee.com/leifermendez
|
||||
|
||||
58
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: 🐛 Reporte Bug
|
||||
description: Algo no va bien?. Hazlo saber
|
||||
labels: [bug, triage]
|
||||
title: '[🐛]'
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Gracias por tomarte el tiempo de reportar este problema
|
||||
|
||||
- type: dropdown
|
||||
id: version
|
||||
attributes:
|
||||
label: ¿Que versión estas usando?
|
||||
description: '__INFO:__ Recuerda que puedes consultar dudas directamente en [discord](https://link.codigoencasa.com/DISCORD)'
|
||||
options:
|
||||
- v2
|
||||
- v1
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: component
|
||||
attributes:
|
||||
label: ¿Sobre que afecta?
|
||||
options:
|
||||
- Flujo de palabras (Flow)
|
||||
- DialogFlow
|
||||
- Base de datos
|
||||
- Otro
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
description: 'Trata de ser lo más claro posible, de esa manera podemos entender el contexto de tu problema y darte una mejor solución'
|
||||
label: Describe tu problema
|
||||
placeholder: Yo tengo un problema....
|
||||
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Reproducir error
|
||||
description: __(Recomendación)__ trata de grabar un video puedes usar algunas de las siguientes herramientas [https://www.vidyard.com/](https://www.vidyard.com/) [https://www.loom.com/](https://www.loom.com/) y en lo posbile apoyate en [https://stackblitz.com/](https://stackblitz.com/) para compartir el código de ser necesario
|
||||
placeholder: URL video o stackblitz
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: additional_information
|
||||
attributes:
|
||||
label: Información Adicional
|
||||
validations:
|
||||
required: false
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
contact_links:
|
||||
- name: 🤔 Core Team
|
||||
url: https://link.codigoencasa.com/DISCORD
|
||||
about: Si quieres formar parte del CoreTeam, patrocinar el proyecto o propuesta profesionales
|
||||
79
.github/ISSUE_TEMPLATE/test-case.yml
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
name: 🐬 Caso de uso
|
||||
description: Reporta tu caso de uso y cuales fueron tus resultados
|
||||
labels: [usecase]
|
||||
title: '[🐬]'
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Gracias por tomarte el tiempo de detallar este caso de uso, sera de gran utilidad para mantener un software de calidad puedes comenzar
|
||||
⚡ `npm create bot-whatsapp@dev`
|
||||
|
||||
- type: dropdown
|
||||
id: version
|
||||
attributes:
|
||||
label: ¿Cual proveedor usaste?
|
||||
description: 'Actualmente tenemos varios proveedores que sirven como punto de entrada y salida con Whatsapp'
|
||||
options:
|
||||
- whatsapp-web.js
|
||||
- venom
|
||||
- bailey
|
||||
- twilio
|
||||
- meta
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: component
|
||||
attributes:
|
||||
label: ¿Cual base de datos usaste?
|
||||
options:
|
||||
- memory
|
||||
- mongo
|
||||
- mysql
|
||||
- json
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: result
|
||||
attributes:
|
||||
label: Conclusion de la prueba
|
||||
options:
|
||||
- muy buena
|
||||
- buena
|
||||
- tiene errores
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
description: 'Trata de ser lo más claro posible, de esa manera podemos entender el contexto del caso de uso'
|
||||
label: Describe tu caso
|
||||
placeholder: Yo tengo un caso....
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: ¿Logs Importantes?
|
||||
description: Si tienes algunos logs importantes a tener en cuenta o que muetren algun error en concreto.
|
||||
render: shell
|
||||
|
||||
- type: textarea
|
||||
id: additional_information
|
||||
attributes:
|
||||
label: Información Adicional
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: usernames
|
||||
attributes:
|
||||
label: ¿Quieres que te mencionemos?
|
||||
description: Siempre buscamos fomentar la comunidad por lo cual si quieres que te mencionemos publicamente en nuestras redes sociales puedes dejar tu username
|
||||
placeholder: twitter o github o instagram o alguna url
|
||||
validations:
|
||||
required: false
|
||||
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Que tipo de Pull Request es?
|
||||
|
||||
- [ ] Mejoras
|
||||
- [ ] Bug
|
||||
- [ ] Docs / tests
|
||||
|
||||
# Descripción
|
||||
|
||||
Por favor agrega una descripción de tu aporte para tener más contexto y poder avanzar más rápido. Si es de ayuda puedes usar plataformar como [https://www.loom.com/](https://www.loom.com/) para grabar un video.
|
||||
|
||||
|
||||
> Forma parte de este proyecto.
|
||||
|
||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||
- [Twitter](https://twitter.com/leifermendez)
|
||||
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||
- [Telegram](https://t.me/leifermendez)
|
||||
46
.github/workflows/check-provider-major.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Rev Major Providers
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 9 * * *'
|
||||
|
||||
jobs:
|
||||
check-npm:
|
||||
name: Install Dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Check Baileys
|
||||
run: yarn node ./scripts/checker.js --name=baileys --stable=true
|
||||
|
||||
- name: Check Venom
|
||||
run: yarn node ./scripts/checker.js --name=venom --stable=true
|
||||
|
||||
- name: Check web-whatsapp
|
||||
run: yarn node ./scripts/checker.js --name=web-whatsapp --stable=true
|
||||
|
||||
- name: Check Meta
|
||||
run: yarn node ./scripts/checker.js --name=meta --stable=true
|
||||
|
||||
- name: Check Twilio
|
||||
run: yarn node ./scripts/checker.js --name=twilio --stable=true
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: 'ci(providers): 🚩 Check BREAKING CHANGE'
|
||||
create_branch: true
|
||||
branch: feature/breaking-change
|
||||
45
.github/workflows/check-providers.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Rev Providers
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
check-npm:
|
||||
name: Install Dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Check Baileys
|
||||
run: yarn node ./scripts/checker.js --name=baileys --stable=true
|
||||
|
||||
- name: Check Venom
|
||||
run: yarn node ./scripts/checker.js --name=venom --stable=true
|
||||
|
||||
- name: Check web-whatsapp
|
||||
run: yarn node ./scripts/checker.js --name=web-whatsapp --stable=true
|
||||
|
||||
- name: Check Meta
|
||||
run: yarn node ./scripts/checker.js --name=meta --stable=true
|
||||
|
||||
- name: Check Twilio
|
||||
run: yarn node ./scripts/checker.js --name=twilio --stable=true
|
||||
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: 'ci(providers): 👍 updated versions stable providers'
|
||||
2
.github/workflows/ci.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: BotWhatsapp Build-Test
|
||||
name: Build and Test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
75
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: 'CodeQL'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main', dev, next-release]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: ['main']
|
||||
schedule:
|
||||
- cron: '21 16 * * 5'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['javascript']
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Use only 'java' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: '/language:${{matrix.language}}'
|
||||
6
.github/workflows/contributors.yml
vendored
@@ -1,9 +1,11 @@
|
||||
name: Add contributors
|
||||
name: Revisando Colaboradores
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
|
||||
46
.github/workflows/netlify-dev.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
name: 📄 Desplegando documentacion
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'feat/docs-**'
|
||||
- 'fix/docs-**'
|
||||
push:
|
||||
branches:
|
||||
- 'feat/docs-**'
|
||||
- 'fix/docs-**'
|
||||
|
||||
jobs:
|
||||
############ DOCUMENTATION BUILD ############
|
||||
build-documentation:
|
||||
name: Build Package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Add netlify
|
||||
run: yarn add netlify-cli -D
|
||||
|
||||
- name: Create .env build file
|
||||
run: |
|
||||
touch packages/docs/.env
|
||||
echo VITE_GITHUB_TOKEN=${{ secrets.COLLABORATORS_TOKEN }} >> packages/docs/.env
|
||||
|
||||
- name: Build and Deploy
|
||||
run: |
|
||||
cd packages/docs
|
||||
netlify deploy --build --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
42
.github/workflows/netlify.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
name: 📄 (PROD) Desplegando documentacion
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- next-release
|
||||
|
||||
jobs:
|
||||
############ DOCUMENTATION BUILD ############
|
||||
build-documentation:
|
||||
name: Build Package
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Add netlify
|
||||
run: yarn add netlify-cli -D
|
||||
|
||||
- name: Create .env build file
|
||||
run: |
|
||||
touch packages/docs/.env
|
||||
echo VITE_GITHUB_TOKEN=${{ secrets.COLLABORATORS_TOKEN }} >> packages/docs/.env
|
||||
|
||||
- name: Build and Deploy
|
||||
run: |
|
||||
cd packages/docs
|
||||
netlify deploy --prod --build --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
13
.github/workflows/releases-dev.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: BotWhatsapp Releases(DEV)
|
||||
name: 🚀 (DEV) Liberando versiones
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -13,10 +13,6 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
@@ -49,8 +45,7 @@ jobs:
|
||||
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Commit Versioning & Push changes
|
||||
uses: actions-js/push@master
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
message: 'ci(version): :zap: automatic - "${date}" updated versions every packages'
|
||||
branch: 'dev'
|
||||
commit_message: 'ci(version): :zap: automatic - "${date}" updated versions every packages'
|
||||
branch: dev
|
||||
|
||||
16
.github/workflows/releases.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: BotWhatsapp Releases(Prod)
|
||||
name: 🚀⚡ Liberando versiones
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -13,10 +13,6 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set output
|
||||
id: vars
|
||||
@@ -52,9 +48,11 @@ jobs:
|
||||
- name: Release @bot-whatsapp/provider
|
||||
run: yarn node ./scripts/release.js --name=provider --version="${{ steps.vars.outputs.tag }}" --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Set CHANGELOG
|
||||
run: yarn release
|
||||
|
||||
- name: Commit Versioning & Push changes
|
||||
uses: actions-js/push@master
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
message: 'ci(version): :zap: automatic - "${date}" updated versions every packages'
|
||||
branch: 'dev'
|
||||
commit_message: 'release(version): 🚀 - "${{ steps.vars.outputs.tag }}" release'
|
||||
branch: dev
|
||||
|
||||
27
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
||||
#
|
||||
# You can adjust the behavior by modifying this file.
|
||||
# For more information, see:
|
||||
# https://github.com/actions/stale
|
||||
name: Revisar ISSUES abandonadas
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '55 22 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: '¿Alguna novedad sobre esta ISSUE?'
|
||||
stale-pr-message: '¿Alguna novedad sobre esta PULL REQUEST?'
|
||||
stale-issue-label: 'no-issue-activity'
|
||||
stale-pr-label: 'no-pr-activity'
|
||||
exempt-issue-assignees: 'leifermendez'
|
||||
4
.gitignore
vendored
@@ -35,4 +35,6 @@ base-*/
|
||||
qr.svg
|
||||
package-lock.json
|
||||
yarn-error.log
|
||||
.npmrc
|
||||
.npmrc
|
||||
# Local Netlify folder
|
||||
.netlify
|
||||
|
||||
24
.vscode/bot.code-snippets
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"Flow Bot (simple)": {
|
||||
"scope": "javascript",
|
||||
"prefix": "bot:flow",
|
||||
"description": "Crear un flujo simple",
|
||||
"body": [
|
||||
"export const flow${1} = addKeyword(['hola', 'buenas'])",
|
||||
" .addAnswer('Hola! 🚀 Bienvenido a este CHATBOT')",
|
||||
" .addAnswer('¿Como puedo ayudarte?')"
|
||||
]
|
||||
},
|
||||
"Flow Bot (completo)": {
|
||||
"scope": "javascript",
|
||||
"prefix": "bot:flow completo",
|
||||
"description": "Crear un flujo completo",
|
||||
"body": [
|
||||
"export const flow${1} = addKeyword(['categorias'])",
|
||||
" .addAnswer('⚡ Tenemos las siguientes categorias')",
|
||||
" .addAnswer(['🚀 Computadoras', '🚀 Celulares', '🚀 Otros'], {",
|
||||
" delay: 1500, //Milisegundo 1500 = 1.5segundos",
|
||||
"})"
|
||||
]
|
||||
}
|
||||
}
|
||||
3
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["xyc.vscode-mdx-preview"]
|
||||
}
|
||||
5
.vscode/settings.json
vendored
@@ -6,6 +6,9 @@
|
||||
"bot",
|
||||
"provider",
|
||||
"adapter",
|
||||
"ci"
|
||||
"ci",
|
||||
"starters",
|
||||
"conflict",
|
||||
"contexts"
|
||||
]
|
||||
}
|
||||
|
||||
107
CHANGELOG.md
@@ -2,6 +2,113 @@
|
||||
|
||||
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.3](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.2...v0.1.3) (2023-01-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **adapter:** :zap: send messages with dialogflow ([c20e151](https://github.com/leifermendez/bot-whatsapp/commit/c20e151e209d33de9e7425a64f003c85360f1832))
|
||||
* **baileys:** added more methods ([1b23b83](https://github.com/leifermendez/bot-whatsapp/commit/1b23b837460ce4533ff33f10f1de5e3a344a5623))
|
||||
* **bot:** :zap: http responses support ([e331c2d](https://github.com/leifermendez/bot-whatsapp/commit/e331c2dcc40eeb82a93f9d29f6a82333b8465927))
|
||||
* **bot:** :zap: http responses support ([2d2bb08](https://github.com/leifermendez/bot-whatsapp/commit/2d2bb085cd95604a84ca3fe5c4ddc84b3824ac1c))
|
||||
* **bot:** :zap: rev-03 everything work fine ([3012e02](https://github.com/leifermendez/bot-whatsapp/commit/3012e026b77ab4e99334b992d166a89189f76503))
|
||||
* **cli:** :sparkles: added bailey ([06acec2](https://github.com/leifermendez/bot-whatsapp/commit/06acec2bf29d72c2b46f4ce81fed115bab97351f))
|
||||
* **cli:** :sparkles: added bailey ([c868f73](https://github.com/leifermendez/bot-whatsapp/commit/c868f7346245bec94582b25a342febc657926c9d))
|
||||
* **conflict:** :zap: remove unused variable ([eba9229](https://github.com/leifermendez/bot-whatsapp/commit/eba92299cfd84c971f09697d027043f19eec2b7c))
|
||||
* **contexts:** :zap: add new dialogflowcx ([4d8cf62](https://github.com/leifermendez/bot-whatsapp/commit/4d8cf623ff86b3d08c8d52293d4e289dfda68e1c))
|
||||
* **contexts:** :zap: add new dialogflowcx ([9885872](https://github.com/leifermendez/bot-whatsapp/commit/98858729919b2544dace07c49badce7888ddfd82))
|
||||
* **contexts:** dialogflowcx support ([9179421](https://github.com/leifermendez/bot-whatsapp/commit/917942139f9736f1c0f8ce5f07b4e12e5768b0c7))
|
||||
* correccion de flujos en app.js de ejemplo ([99f508f](https://github.com/leifermendez/bot-whatsapp/commit/99f508f93889d70240861158bc304c25a3b2daef))
|
||||
* **docs:** master class updated ([69fd81a](https://github.com/leifermendez/bot-whatsapp/commit/69fd81a565e61b249ac50917585293d2d84e3dd4))
|
||||
* **docs:** master class updated ([d522b03](https://github.com/leifermendez/bot-whatsapp/commit/d522b03e2e6e6e3f7c467c59e3d2d6f288fe37b2))
|
||||
* **provider:** :bug: dialogflow ([4ec6f1e](https://github.com/leifermendez/bot-whatsapp/commit/4ec6f1e120879e545fa111615f2d79b792d947a5))
|
||||
* **provider:** :sparkles: added dialogflow ([2f633c7](https://github.com/leifermendez/bot-whatsapp/commit/2f633c72da24f98d6c318d1e725571b62e04604c))
|
||||
* **provider:** :sparkles: added dialogflow ([798f1ce](https://github.com/leifermendez/bot-whatsapp/commit/798f1cebdefe43624c1698a219dcb224bb842d38))
|
||||
* **provider:** :sparkles: endpoint is added to validate the webhook … ([478929d](https://github.com/leifermendez/bot-whatsapp/commit/478929d1340d46d6bf997ae8edabbaae4511172d))
|
||||
* **provider:** :sparkles: endpoint is added to validate the webhook token ([1ec1564](https://github.com/leifermendez/bot-whatsapp/commit/1ec15647dc462363d5b765f42debddbe6ef6266b))
|
||||
* **provider:** :zap: add new methods ([0b4e353](https://github.com/leifermendez/bot-whatsapp/commit/0b4e35308dace0ccdf618cb1d04987ed5200d58c))
|
||||
* **provider:** :zap: add sendfile and sendButtons ([5433610](https://github.com/leifermendez/bot-whatsapp/commit/5433610a84d7a050a387e4daf2ded1daebfc03a4))
|
||||
* **provider:** :zap: add sendfile and sendButtons ([342cbcc](https://github.com/leifermendez/bot-whatsapp/commit/342cbccff1d09f9aabe5423ad6d686d590a2448f))
|
||||
* **provider:** :zap: added new venom provider ([01fe9eb](https://github.com/leifermendez/bot-whatsapp/commit/01fe9ebc9a943f2aa086ee415153d1cccdb14ec0))
|
||||
* **provider:** :zap: added tamplate venom ([337c2e9](https://github.com/leifermendez/bot-whatsapp/commit/337c2e94bccd0ae173958fe2db08b494bdc93c28))
|
||||
* **provider:** :zap: baileysProvider ([23b2e8e](https://github.com/leifermendez/bot-whatsapp/commit/23b2e8e439ecec24450bd5cf1a3820316e643434))
|
||||
* **provider:** :zap: solution error buttons ([1b83871](https://github.com/leifermendez/bot-whatsapp/commit/1b83871cca6996c6acae3d4c8b6b42aec05ea146))
|
||||
* **provider:** :zap: solution error utils venom ([31c83f5](https://github.com/leifermendez/bot-whatsapp/commit/31c83f5d689a01490d3adb96006f54c2a5d3268b))
|
||||
* **provider:** :zap: update ([b62d21a](https://github.com/leifermendez/bot-whatsapp/commit/b62d21a0bf94466e43c25c6e8c0f5db9ae91c572))
|
||||
* **provider:** :zap: update ([0c94647](https://github.com/leifermendez/bot-whatsapp/commit/0c94647a27747c3ddf4f02926580370f0d81bdc2))
|
||||
* **provider:** meta provider is added ([b041f7d](https://github.com/leifermendez/bot-whatsapp/commit/b041f7d0c7cc6f152d3f36785d1d398a4141d57d))
|
||||
* **provider:** meta provider is added ([438607c](https://github.com/leifermendez/bot-whatsapp/commit/438607c222b91d6f8814201dabe5f7c3e7ba1abb))
|
||||
* **provider:** new added baileys ([4e0fcbd](https://github.com/leifermendez/bot-whatsapp/commit/4e0fcbd8347f8a430adb43351b5415098a5d10df))
|
||||
* **provider:** new provider - venon:zap: configuracion inicial provi… ([66f75f8](https://github.com/leifermendez/bot-whatsapp/commit/66f75f872200334bfc9eda744bed92c509dfee56))
|
||||
* **provider:** new provider - venon:zap: configuracion inicial provider venom ([fee7c2e](https://github.com/leifermendez/bot-whatsapp/commit/fee7c2e967b7fe8835b5acc243c19f7713acfbe7))
|
||||
* se agregaron los datros del adapter mongo en app.js y package.json ([8160d13](https://github.com/leifermendez/bot-whatsapp/commit/8160d13c866b8ae17b0ec8e68eee1bc0373595b0))
|
||||
* se agrego informacion al ejemplo en app.js ([954e751](https://github.com/leifermendez/bot-whatsapp/commit/954e751f700c6a39ec70c0bc5168637c0dc7e07c))
|
||||
* se agrego informacion al ejemplo en app.js ([b2f1339](https://github.com/leifermendez/bot-whatsapp/commit/b2f13396104db9ccef5b3bad1c4e19c6a4bad2d4))
|
||||
* **starters:** meta memory base template added ([11c784f](https://github.com/leifermendez/bot-whatsapp/commit/11c784f882965d6bd3a2313cf91bed9fb3aa5f26))
|
||||
* **starters:** meta memory base template added ([e8d6252](https://github.com/leifermendez/bot-whatsapp/commit/e8d625201ed86e162e0b4e82100ede1d08985555))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :art: update ([7d6708c](https://github.com/leifermendez/bot-whatsapp/commit/7d6708c01bbdc5043a7e6ed56fe15a9618115b91))
|
||||
* :sparkles: updated starters ([5da4b7a](https://github.com/leifermendez/bot-whatsapp/commit/5da4b7a4d1e5950be94361ac439938741b9d299c))
|
||||
* actualizar app.js de ejemplo ([1746613](https://github.com/leifermendez/bot-whatsapp/commit/17466138ddcef60a23a0c87911f22045f26d3233))
|
||||
* actualizar ejemplo app.js ([60fdbf3](https://github.com/leifermendez/bot-whatsapp/commit/60fdbf3d3cd62819e618853a9dc2fd0e23fe8752))
|
||||
* **adapter:** :fire: clear log ([9ad4874](https://github.com/leifermendez/bot-whatsapp/commit/9ad4874fdafabfbf0e9e20e6b3281f702bb9fbe7))
|
||||
* **adapter:** :fire: clear log ([4d34d3a](https://github.com/leifermendez/bot-whatsapp/commit/4d34d3ab1daab4e72fb5244216c78cf836d1a164))
|
||||
* **adapter:** :fire: improvement baileys ([e6fefb4](https://github.com/leifermendez/bot-whatsapp/commit/e6fefb4049847f996f2a169b9acfc27c2428d3e6))
|
||||
* **adapter:** :fire: improvement baileys ([2d5ac26](https://github.com/leifermendez/bot-whatsapp/commit/2d5ac2664bea09e60ac85ff2612609ae21050945))
|
||||
* **adapter:** :rocket: venom update - cli - qr iamge ([041bf62](https://github.com/leifermendez/bot-whatsapp/commit/041bf6280e5f6956393716907e0669aa3ca78b4a))
|
||||
* **adapter:** :rocket: venom update - cli - qr iamge ([e37fd0d](https://github.com/leifermendez/bot-whatsapp/commit/e37fd0da3635aa1041664d490d5f9803d2c441ca))
|
||||
* **adapter:** :rocket: venom update - cli - qr iamge ([ca6afbb](https://github.com/leifermendez/bot-whatsapp/commit/ca6afbb87fceec12d4a383486ad693905e36881f))
|
||||
* **adapter:** json db change is made ([386c1bb](https://github.com/leifermendez/bot-whatsapp/commit/386c1bbbac036aa58335fb5f62e3af2493766b6b))
|
||||
* **adapter:** json db change is made ([3bdc7af](https://github.com/leifermendez/bot-whatsapp/commit/3bdc7afe8062527ff08620650d2c1177dfea83f5))
|
||||
* agregamos variables para mysql ([dcf65b8](https://github.com/leifermendez/bot-whatsapp/commit/dcf65b87bc7e7e6381e6448e83118077986898e7))
|
||||
* **bot:** :ambulance: fix callback functions ([d9aa97c](https://github.com/leifermendez/bot-whatsapp/commit/d9aa97c7819aca1446657bc0b75e9732f0f20c6b)), closes [#252](https://github.com/leifermendez/bot-whatsapp/issues/252)
|
||||
* **bot:** :ambulance: fix callback functions ([964a074](https://github.com/leifermendez/bot-whatsapp/commit/964a074aa41324bd09d0c4e2e7aa663a0602b69c))
|
||||
* **bot:** :fire: fix rev ([21407c0](https://github.com/leifermendez/bot-whatsapp/commit/21407c0e37f1ab12efecf887e699cedf05e3946a))
|
||||
* **bot:** :fire: fix rev ([484c8c3](https://github.com/leifermendez/bot-whatsapp/commit/484c8c3bdefbc7824c32a86090bafae0593ecdac))
|
||||
* **bot:** :zap: working callback Phase 1 ([952ce86](https://github.com/leifermendez/bot-whatsapp/commit/952ce86ffaa48a0d6fbc0a00a08c5d1efa14ee8e))
|
||||
* **bot:** :zap: working nested new flow ([2cbc962](https://github.com/leifermendez/bot-whatsapp/commit/2cbc96245d795de749d894a3a0d99b6550f08d9e))
|
||||
* **cli:** :art: starters ([a2be57f](https://github.com/leifermendez/bot-whatsapp/commit/a2be57f0aa42c6b5e13ad19c34abc7d9e81dc135))
|
||||
* **cli:** :art: starters ([670ecf1](https://github.com/leifermendez/bot-whatsapp/commit/670ecf121babf53e76c2ea106c0710cbe59facde))
|
||||
* **cli:** :fire: update instructions ([e585e2f](https://github.com/leifermendez/bot-whatsapp/commit/e585e2f5f644ed0188dc9cd2b3c697c9d6050669))
|
||||
* **cli:** :fire: update instructions ([ed36ce0](https://github.com/leifermendez/bot-whatsapp/commit/ed36ce0a7796320c6a4a452f29c05a3f0f7368db))
|
||||
* **cli:** :fire: update instructions ([bad1694](https://github.com/leifermendez/bot-whatsapp/commit/bad16943fc2089887d6bf0b6d90075d3bec6f9c7))
|
||||
* **cli:** :fire: update instructions ([a21633f](https://github.com/leifermendez/bot-whatsapp/commit/a21633fb7cf348cc37f4e4714f51172b49b193b5))
|
||||
* **cli:** :zap: updated ([a6f4aa8](https://github.com/leifermendez/bot-whatsapp/commit/a6f4aa8d1e809330c06c165aaf9a9f90b8922bb5))
|
||||
* **conflict:** conflict resolution ([71d43b5](https://github.com/leifermendez/bot-whatsapp/commit/71d43b585a0ce173061c84e9879915e4602db026))
|
||||
* **contexts:** :fire: added buttons ([eabef7a](https://github.com/leifermendez/bot-whatsapp/commit/eabef7a92d005cd0190196cfe75828c38885aadf))
|
||||
* **contexts:** :fire: added buttons ([1b878d2](https://github.com/leifermendez/bot-whatsapp/commit/1b878d2ba0daeb3609af74a2ebae7948456e7fb0))
|
||||
* **contexts:** :fire: added buttons ([78b0a9d](https://github.com/leifermendez/bot-whatsapp/commit/78b0a9dddc2a6e0fceb721ee7794efa2047f25fc))
|
||||
* **contexts:** :fire: added buttons ([d8309f7](https://github.com/leifermendez/bot-whatsapp/commit/d8309f77e1d9137c0bec977ed9faef633cd90552))
|
||||
* correccion en app.js para remover addChild en starters ([32db429](https://github.com/leifermendez/bot-whatsapp/commit/32db429f2946f344d949cb169a9595d657c06279))
|
||||
* fix del db provider mysql ([b59d4fc](https://github.com/leifermendez/bot-whatsapp/commit/b59d4fcdd7462cde3f68ab5746d49960b547a592))
|
||||
* provider equivocado en app.js de venom ([4e0a109](https://github.com/leifermendez/bot-whatsapp/commit/4e0a1091ee85cedfaa5a9c3d40e5cd50bc36cda3))
|
||||
* **provider:** :bug: create static site html qr ([c7e56a4](https://github.com/leifermendez/bot-whatsapp/commit/c7e56a4b13c8829f91769eeca7f1f6b3473f68cf))
|
||||
* **provider:** :bug: fix metea provider ([85f50be](https://github.com/leifermendez/bot-whatsapp/commit/85f50be9dcbf3817107898d8d2980baf05acd678))
|
||||
* **provider:** :bug: fix metea provider ([a52aaa1](https://github.com/leifermendez/bot-whatsapp/commit/a52aaa11d883bbaf526cf87720d3c3fd9f89a986))
|
||||
* **provider:** :bug: qr code accurate ([6c4845d](https://github.com/leifermendez/bot-whatsapp/commit/6c4845d733720d9916bb4008f9069ae4fd986a4b))
|
||||
* **provider:** :bug: qr code accurate ([91bfdc4](https://github.com/leifermendez/bot-whatsapp/commit/91bfdc46301207cbc5274308da6f39c7b4652c63))
|
||||
* **provider:** :fire: baileys fix ([928365d](https://github.com/leifermendez/bot-whatsapp/commit/928365dcafb3631acf6b1d0c239a906f8e1c4b0d))
|
||||
* **provider:** :fire: send message togther with media ([78aa23f](https://github.com/leifermendez/bot-whatsapp/commit/78aa23fab094059145f82e6781f9366d5d582b4f))
|
||||
* **provider:** :fire: send message togther with media ([b6bf43d](https://github.com/leifermendez/bot-whatsapp/commit/b6bf43d70fc28c6a229522b9b0de76cec43ac864))
|
||||
* **provider:** :zap: baileys fix restart ([ae83774](https://github.com/leifermendez/bot-whatsapp/commit/ae83774365027e2e86127ab7713ae9ee2df31f33))
|
||||
* **provider:** :zap: edit starter ([ff65832](https://github.com/leifermendez/bot-whatsapp/commit/ff65832012003423cc86d25cf0923452b1f8acb7))
|
||||
* **provider:** :zap: edit starter ([68dd182](https://github.com/leifermendez/bot-whatsapp/commit/68dd1820f05d04780824b318072d053eaf7db654))
|
||||
* **provider:** :zap: json space ([3cef741](https://github.com/leifermendez/bot-whatsapp/commit/3cef741c9ee30024eb42770a5f32931fcd372160))
|
||||
* **provider:** :zap: json space ([9b087e0](https://github.com/leifermendez/bot-whatsapp/commit/9b087e071019a7b6c79195a24dc7ddec498c5716))
|
||||
* **provider:** :zap: json space ([208fb4e](https://github.com/leifermendez/bot-whatsapp/commit/208fb4e9131dd5d4fd7230ba1aa11181337d9181))
|
||||
* **provider:** :zap: json space ([54a59c7](https://github.com/leifermendez/bot-whatsapp/commit/54a59c7f0d4dbaab006ce7e3c74412d8d3613ecd))
|
||||
* **provider:** qr-fix margin ([663641a](https://github.com/leifermendez/bot-whatsapp/commit/663641a1b8bf9234a88b0f3c38381ebc4bfa4bf9))
|
||||
* se quito addChild de las constantes porque no se usa ([ba2291a](https://github.com/leifermendez/bot-whatsapp/commit/ba2291a3ddac0d4101021e11d03cb222c5a4bb3b))
|
||||
* **starters:** :fire: updated staters ([4d4f15c](https://github.com/leifermendez/bot-whatsapp/commit/4d4f15ce73486d9335ad474d9e37c3b155670134))
|
||||
* **starters:** :fire: updated staters ([a30eaac](https://github.com/leifermendez/bot-whatsapp/commit/a30eaac77534d17eb980f6ec126140e9d30aa06e))
|
||||
* **starters:** :memo: update MIGRATION ([37fe323](https://github.com/leifermendez/bot-whatsapp/commit/37fe32322eb1bd41eecd151e52f17ec0588fb85e))
|
||||
* **starters:** :memo: update MIGRATION ([9b30e7d](https://github.com/leifermendez/bot-whatsapp/commit/9b30e7dcfc30bc160b56427cc6cdc2dc982bde2a))
|
||||
* **starters:** base templates are added for meta ([229e017](https://github.com/leifermendez/bot-whatsapp/commit/229e017ae20b84c9d12c7282f97b7034f5f33e6d))
|
||||
* **starters:** base templates are added for meta ([20f6651](https://github.com/leifermendez/bot-whatsapp/commit/20f665175c9b47226df41ce43e05574bd6ab1930))
|
||||
|
||||
### [0.1.2](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.1...v0.1.2) (2022-12-12)
|
||||
|
||||
|
||||
|
||||
128
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
leifer.contacto@gmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
@@ -1,7 +1,25 @@
|
||||
# CONTRIBUTING
|
||||
|
||||
### 📄 Bienvenido/a
|
||||
Si deseas colaborar con el proyecto existen varias maneras, la primera de ellas es aportando conocimiento y mejorando el repositorio (actualizando documentación, mejorando código, revisando __[issues](https://github.com/codigoencasa/bot-whatsapp/issues)__, etc).
|
||||
|
||||
También es bien recibido los aportes económicos que se utilizaran para diferentes fines __[ver más](https://opencollective.com/bot-whatsapp)__
|
||||
|
||||
El lenguaje principal que se utilizó para desarrollar este proyecto fue __JavaScript__ con el fin de qué personas que están iniciando en el mundo de la programación puedan entender fácilmente.
|
||||
|
||||
|
||||
### 🤔 Preguntas frecuentes
|
||||
- ¿Como puedo hacer aportaciones de código en el proyecto?: [Ver Video](https://youtu.be/Lxt8Acob6aU)
|
||||
- ¿Como ejecutar el entorno de pruebas?: [Ver Video](https://youtu.be/Mf9V-dloBfk)
|
||||
- ¿Como crear un nuevo proveedor?: [Ver Video](https://youtu.be/cahK9zH3SI8)
|
||||
- ¿Que son los GithubActions?: [Ver Video](https://youtu.be/nYBEBFKLiqw)
|
||||
- ¿Canales de comunicación?: [Discord](https://link.codigoencasa.com/DISCORD)
|
||||
|
||||
-----
|
||||
|
||||

|
||||
|
||||
|
||||
__Requerimientos:__
|
||||
- Node v16 o superior __[descargar node](https://nodejs.org/es/download/)__
|
||||
- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguirás las intrucciones para instalar yarn.
|
||||
@@ -13,7 +31,7 @@ __Requerimientos:__
|
||||
|
||||
__Clonar repo rama dev__
|
||||
```
|
||||
git clone --branch dev https://github.com/leifermendez/bot-whatsapp
|
||||
git clone --branch dev https://github.com/codigoencasa/bot-whatsapp
|
||||
```
|
||||
__Instalar dependencias__
|
||||
```
|
||||
@@ -34,24 +52,49 @@ Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de e
|
||||
yarn run cli
|
||||
```
|
||||
|
||||
Abrir carpeta __example-app-base__ y ejecutar
|
||||
Selecionas (mediante las flechas arriba y abajo) el proveedor que quieras usar y cuando estes sobre el presiona la barra de espacio, igualmente selecciona la base de datos que quieras usar.
|
||||
|
||||
Se creó un subdirecorio con el nombre del proveedor y base de datos que seleccionaste, ejemplo: `base-bailey-mysql`
|
||||
|
||||
Dentro de ese directorio necesitas editar el archivo package.json y borrar las siguientes lineas:
|
||||
```
|
||||
cd example-app-base
|
||||
npm i
|
||||
"@bot-whatsapp/bot": "latest",
|
||||
"@bot-whatsapp/cli": "latest",
|
||||
"@bot-whatsapp/database": "latest",
|
||||
"@bot-whatsapp/provider": "latest",
|
||||
```
|
||||
|
||||
Cambiate al directorio creado ejemplo: `base-bailey-mysql`
|
||||
```
|
||||
cd base-baileys-mysql
|
||||
```
|
||||
Ejecuta los comandos:
|
||||
```
|
||||
npm install
|
||||
npm run pre-copy
|
||||
npm start
|
||||
```
|
||||
En el caso de MySql y Mongo es necesario especificar en app.js los datos de la conexión, ejemplo de MySql:
|
||||
```
|
||||
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
||||
const MySQLAdapter = require('@bot-whatsapp/database/mysql')
|
||||
|
||||
### __Commit y Push__
|
||||
/**
|
||||
* Declaramos las conexiones de MySQL
|
||||
*/
|
||||
const MYSQL_DB_HOST = 'localhost'
|
||||
const MYSQL_DB_USER = 'usr'
|
||||
const MYSQL_DB_PASSWORD = 'pass'
|
||||
const MYSQL_DB_NAME = 'bot'
|
||||
```
|
||||
<!-- __Seguir instrucciones__
|
||||
En la consola encontraras los pasos a seguir -->
|
||||
|
||||
El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__, es una herramienta que dispara unas acciones al momento de hacer commit y hacer push.
|
||||
|
||||
__commit:__ Los commit son semánticos, esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo: ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__
|
||||
|
||||
__push:__ Cada push ejecutar `yarn run test` el cual realiza los test internos que tienen que cumplir con __95% de cobertura__.
|
||||

|
||||
|
||||
|
||||
> Documento en constante actualización....
|
||||
> __NOTA:__ [Eres libre de aportar informacion a este documento o arreglar ortografia 🤣](
|
||||
https://github.com/codigoencasa/bot-whatsapp/edit/dev/CONTRIBUTING.md)
|
||||
|
||||
------
|
||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
CTX: Es el objeto que representa un mensaje, con opciones, id, ref
|
||||
messageInComming: Objeto entrante del provider {body, from,...}
|
||||
messageInComming: Objeto entrante del provider {body, from,to,...}
|
||||
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 Leifer Mendez
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
214
MIGRATION.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# Migración
|
||||
|
||||
#### Versión (legacy)
|
||||
|
||||
En la ***versión (legacy)*** se implementaban los flujos de esta manera, en dos archivos independientes.
|
||||
|
||||
> __`initial.json`__ para establecer las palabras claves y el flujo a responder, por otro lado tambien se necesitaba implementar
|
||||
> __`response.json`__ donde se escriben los mensajes a responder.
|
||||
|
||||
```json
|
||||
//initial.json
|
||||
[
|
||||
{
|
||||
"keywords": [
|
||||
"hola",
|
||||
"ola",
|
||||
"alo"
|
||||
],
|
||||
"key": "hola"
|
||||
},
|
||||
{
|
||||
"keywords": ["productos", "info"],
|
||||
"key": "productos"
|
||||
},
|
||||
{
|
||||
"keywords": ["adios", "bye"],
|
||||
"key": "adios"
|
||||
},
|
||||
{
|
||||
"keywords": ["imagen", "foto"],
|
||||
"key": "catalogo"
|
||||
}
|
||||
]
|
||||
```
|
||||
```json
|
||||
//response.json
|
||||
{
|
||||
"hola":{
|
||||
"replyMessage":[
|
||||
"Gracias a ti! \n"
|
||||
],
|
||||
"media":null,
|
||||
"trigger":null
|
||||
},
|
||||
"adios":{
|
||||
"replyMessage":[
|
||||
"Que te vaya bien!!"
|
||||
],
|
||||
},
|
||||
"productos":{
|
||||
"replyMessage":[
|
||||
"Más productos aquí"
|
||||
],
|
||||
"trigger":null,
|
||||
"actions":{
|
||||
"title":"¿Que te interesa ver?",
|
||||
"message":"Abajo unos botons",
|
||||
"footer":"",
|
||||
"buttons":[
|
||||
{"body":"Telefonos"},
|
||||
{"body":"Computadoras"},
|
||||
{"body":"Otros"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"catalogo":{
|
||||
"replyMessage":[
|
||||
"Te envio una imagen"
|
||||
],
|
||||
"media":"https://media2.giphy.com/media/VQJu0IeULuAmCwf5SL/giphy.gif",
|
||||
"trigger":null,
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Versión 2 (0.2.X)
|
||||
|
||||
En esta versión es mucho más sencillo, abajo encontraras un ejemplo del mismo flujo anteriormente mostrado.
|
||||
|
||||
```js
|
||||
//app.js
|
||||
const {
|
||||
createBot,
|
||||
createProvider,
|
||||
createFlow,
|
||||
addKeyword,
|
||||
addChild,
|
||||
} = require('@bot-whatsapp/bot')
|
||||
|
||||
const BaileysProvider = require('@bot-whatsapp/provider/baileys')
|
||||
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||
/**
|
||||
* Declarando flujos principales.
|
||||
*/
|
||||
const flowHola = addKeyword(['hola', 'ola', 'alo'])
|
||||
.addAnswer('Bienvenido a tu tienda online!')
|
||||
|
||||
const flowAdios = addKeyword(['adios', 'bye'])
|
||||
.addAnswer('Que te vaya bien!!')
|
||||
.addAnswer('Hasta luego!')
|
||||
|
||||
const flowProductos = addKeyword(['productos', 'info'])
|
||||
.addAnswer('Te envio una imagen', {
|
||||
buttons:[
|
||||
{body:"Telefonos"},
|
||||
{body:"Computadoras"},
|
||||
{body:"Otros"}
|
||||
]
|
||||
})
|
||||
|
||||
const flowCatalogo = addKeyword(['imagen', 'foto'])
|
||||
.addAnswer('Te envio una imagen', {media:'https://media2.giphy.com/media/VQJu0IeULuAmCwf5SL/giphy.gif'})
|
||||
|
||||
|
||||
const main = async () => {
|
||||
const adapterDB = new MockAdapter()
|
||||
const adapterFlow = createFlow([flowHola, flowAdios, flowProductos, flowCatalogo])
|
||||
const adapterProvider = createProvider(BaileysProvider)
|
||||
createBot({
|
||||
flow: adapterFlow,
|
||||
provider: adapterProvider,
|
||||
database: adapterDB,
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
#### Flujos hijos
|
||||
|
||||
A continuación se muestra un ejemplo de flujos hijos, estos nos sirven para crear flujos que solo se disparan cuando el flujo anterior es el especificado, ejemplo:
|
||||
|
||||
> Menu Principal (Escoge zapatos o bolsos)
|
||||
> - SubMenu 1 (Elegiste bolsos, ahora escoge piel o tela)
|
||||
> - Submenu 1.1 (piel)
|
||||
> - Submenu 2 (Elegiste zapatos, ahora escoge piel o tela)
|
||||
> - Submenu 2.1 (piel)
|
||||
|
||||
El __submenu 1__ solo se va a disparar cuando el flujo anterior sea el __principal__, e igualmente el __submenu 1.1__, solo cuando el flujo anterior sea el __submenu 1__, ejemplo:
|
||||
|
||||
```js
|
||||
/**
|
||||
* Aqui declaramos los flujos hijos, los flujos se declaran de atras para adelante, es decir que si tienes un flujo de este tipo:
|
||||
*
|
||||
* Menu Principal
|
||||
* - SubMenu 1
|
||||
* - Submenu 1.1
|
||||
* - Submenu 2
|
||||
* - Submenu 2.1
|
||||
*
|
||||
* Primero declaras los submenus 1.1 y 2.1, luego el 1 y 2 y al final el principal.
|
||||
*/
|
||||
const flowBolsos2 = addKeyword(['bolsos2', '2'])
|
||||
.addAnswer('🤯 *MUCHOS* bolsos ...')
|
||||
.addAnswer('y mas bolsos... bla bla')
|
||||
|
||||
const flowZapatos2 = addKeyword(['zapatos2', '2'])
|
||||
.addAnswer('🤯 repito que tengo *MUCHOS* zapatos.')
|
||||
.addAnswer('y algunas otras cosas.')
|
||||
|
||||
const flowZapatos = addKeyword(['1', 'zapatos', 'ZAPATOS'])
|
||||
.addAnswer('🤯 Veo que elegiste zapatos')
|
||||
.addAnswer('Tengo muchos zapatos...bla bla')
|
||||
.addAnswer(
|
||||
['Manda:', '*(2) Zapatos2*', 'para mas información'],
|
||||
{ capture: true },
|
||||
(ctx) => {
|
||||
console.log('Aqui puedes ver más info del usuario...')
|
||||
console.log('Puedes enviar un mail, hook, etc..')
|
||||
console.log(ctx)
|
||||
},
|
||||
[...addChild(flowZapatos2)]
|
||||
)
|
||||
|
||||
const flowBolsos = addKeyword(['2', 'bolsos', 'BOLSOS'])
|
||||
.addAnswer('🙌 Veo que elegiste bolsos')
|
||||
.addAnswer('Tengo muchos bolsos...bla bla')
|
||||
.addAnswer(
|
||||
['Manda:', '*(2) Bolsos2*', 'para mas información.'],
|
||||
{ capture: true },
|
||||
(ctx) => {
|
||||
console.log('Aqui puedes ver más info del usuario...')
|
||||
console.log('Puedes enviar un mail, hook, etc..')
|
||||
console.log(ctx)
|
||||
},
|
||||
[...addChild(flowBolsos2)]
|
||||
)
|
||||
|
||||
/**
|
||||
* Declarando flujo principal
|
||||
*/
|
||||
|
||||
const flowPrincipal = addKeyword(['hola', 'ole', 'alo'])
|
||||
.addAnswer(['Hola, bienvenido a mi tienda', '¿Como puedo ayudarte?'])
|
||||
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc ...'])
|
||||
.addAnswer(
|
||||
['Para continuar escribe:', '*(1) Zapatos*', '*(2) Bolsos*'],
|
||||
{ capture: true },
|
||||
(ctx) => {
|
||||
console.log('Aqui puedes ver más info del usuario...')
|
||||
console.log('Puedes enviar un mail, hook, etc..')
|
||||
console.log(ctx)
|
||||
},
|
||||
[...addChild(flowBolsos), ...addChild(flowZapatos)]
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
> Forma parte de este proyecto.
|
||||
|
||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||
- [Twitter](https://twitter.com/leifermendez)
|
||||
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||
- [Telegram](https://t.me/leifermendez)
|
||||
124
README.md
@@ -1,16 +1,46 @@
|
||||
[](https://github.com/leifermendez/bot-whatsapp/actions/workflows/ci.yml)
|
||||
# Chatbot Library
|
||||

|
||||
[](http://commitizen.github.io/cz-cli/)
|
||||
--------
|
||||
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
||||
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
|
||||
🚀 __Roadmap:__ [https://github.com/users/leifermendez/projects/4/views/1](https://github.com/users/leifermendez/projects/4/views/1)
|
||||
[](https://github.com/codigoencasa/bot-whatsapp/actions/workflows/releases.yml)
|
||||
|
||||
|
||||
**Comunidad**
|
||||
<p align="center">
|
||||
<img width="300" src="https://i.imgur.com/Oauef6t.png">
|
||||
</p>
|
||||
|
||||
|
||||
**Con esta librería, puedes construir flujos automatizados de conversación de manera agnóstica al proveedor de WhatsApp,** configurar respuestas automatizadas para preguntas frecuentes, recibir y responder mensajes de manera automatizada, y hacer un seguimiento de las interacciones con los clientes. Además, puedes configurar fácilmente disparadores que te ayudaran a expandir las funcionalidades sin límites. **[Ver más informacion](https://bot-whatsapp.netlify.app/)**
|
||||
|
||||
## Comenzar
|
||||
|
||||
```
|
||||
npm create bot-whatsapp@latest
|
||||
```
|
||||
|
||||
Entiende más a fondo sus funcionalidades explicadas en nuestra documentación.
|
||||
|
||||
- Instalacion
|
||||
- Base de datos
|
||||
- Proveedores
|
||||
|
||||
## Recursos
|
||||
- [📄 Documentación](https://bot-whatsapp.netlify.app/)
|
||||
- [🚀 Roadmap](https://github.com/orgs/codigoencasa/projects/1)
|
||||
- [💻 Discord](https://link.codigoencasa.com/DISCORD)
|
||||
- [👌 Twitter](https://twitter.com/leifermendez)
|
||||
- [🎥 Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||
|
||||
## Comunidad
|
||||
<!-- readme: collaborators,contributors -start -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/cheveguerra">
|
||||
<img src="https://avatars.githubusercontent.com/u/5891114?v=4" width="50;" alt="cheveguerra"/>
|
||||
<br />
|
||||
<sub><b>Jose Alberto Guerra Ugalde</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/leifermendez">
|
||||
<img src="https://avatars.githubusercontent.com/u/15802366?v=4" width="50;" alt="leifermendez"/>
|
||||
@@ -18,20 +48,6 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
<sub><b>Leifer Mendez</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/aurik3">
|
||||
<img src="https://avatars.githubusercontent.com/u/37228512?v=4" width="50;" alt="aurik3"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/vicente1992">
|
||||
<img src="https://avatars.githubusercontent.com/u/57806030?v=4" width="50;" alt="vicente1992"/>
|
||||
<br />
|
||||
<sub><b>Manuel Vicente Ortiz</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/leifermendezfroged">
|
||||
<img src="https://avatars.githubusercontent.com/u/97020486?v=4" width="50;" alt="leifermendezfroged"/>
|
||||
@@ -39,6 +55,49 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
<sub><b>Leifer Mendez</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/vicente1992">
|
||||
<img src="https://avatars.githubusercontent.com/u/57806030?v=4" width="50;" alt="vicente1992"/>
|
||||
<br />
|
||||
<sub><b>Manuel Vicente Ortiz</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/danielcasta0398">
|
||||
<img src="https://avatars.githubusercontent.com/u/98791147?v=4" width="50;" alt="danielcasta0398"/>
|
||||
<br />
|
||||
<sub><b>Juan Daniel Castaño</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/marianarolfo">
|
||||
<img src="https://avatars.githubusercontent.com/u/68322254?v=4" width="50;" alt="marianarolfo"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/HKong31">
|
||||
<img src="https://avatars.githubusercontent.com/u/113340082?v=4" width="50;" alt="HKong31"/>
|
||||
<br />
|
||||
<sub><b>HLKong</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jzvi12">
|
||||
<img src="https://avatars.githubusercontent.com/u/10729787?v=4" width="50;" alt="jzvi12"/>
|
||||
<br />
|
||||
<sub><b>Zvi</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/JosephVTX">
|
||||
<img src="https://avatars.githubusercontent.com/u/91026290?v=4" width="50;" alt="JosephVTX"/>
|
||||
<br />
|
||||
<sub><b>Joseph Vega Callupe</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/Gonzalito87">
|
||||
<img src="https://avatars.githubusercontent.com/u/100331586?v=4" width="50;" alt="Gonzalito87"/>
|
||||
@@ -47,13 +106,27 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jzvi12">
|
||||
<img src="https://avatars.githubusercontent.com/u/10729787?v=4" width="50;" alt="jzvi12"/>
|
||||
<a href="https://github.com/aurik3">
|
||||
<img src="https://avatars.githubusercontent.com/u/37228512?v=4" width="50;" alt="aurik3"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jlferrete">
|
||||
<img src="https://avatars.githubusercontent.com/u/36698913?v=4" width="50;" alt="jlferrete"/>
|
||||
<br />
|
||||
<sub><b>Jose Luis Ferrete Olarte</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/6rak0">
|
||||
<img src="https://avatars.githubusercontent.com/u/12260031?v=4" width="50;" alt="6rak0"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/tonyvazgar">
|
||||
<img src="https://avatars.githubusercontent.com/u/21047090?v=4" width="50;" alt="tonyvazgar"/>
|
||||
@@ -85,9 +158,4 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
</table>
|
||||
<!-- readme: collaborators,contributors -end -->
|
||||
|
||||
> Forma parte de este proyecto.
|
||||
|
||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||
- [Twitter](https://twitter.com/leifermendez)
|
||||
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||
- [Telegram](https://t.me/leifermendez)
|
||||
21
SECURITY.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
||||
@@ -1,3 +0,0 @@
|
||||
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/root",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
|
||||
"main": "app.js",
|
||||
"private": true,
|
||||
@@ -10,6 +10,7 @@
|
||||
"create-bot:rollup": "rollup --config ./packages/create-bot-whatsapp/rollup-create.config.js ",
|
||||
"bot:rollup": "rollup --config ./packages/bot/rollup-bot.config.js",
|
||||
"provider:rollup": "rollup --config ./packages/provider/rollup-provider.config.js ",
|
||||
"contexts:rollup": "rollup --config ./packages/contexts/rollup-contexts.config.js",
|
||||
"database:rollup": "rollup --config ./packages/database/rollup-database.config.js",
|
||||
"create-bot-whatsapp:rollup": "rollup --config ./packages/create-bot-whatsapp/rollup-create.config.js",
|
||||
"format:check": "prettier --check ./packages",
|
||||
@@ -17,7 +18,7 @@
|
||||
"fmt.staged": "pretty-quick --staged",
|
||||
"lint:check": "eslint ./packages",
|
||||
"lint:fix": "eslint --fix ./packages",
|
||||
"build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup && yarn run create-bot-whatsapp:rollup",
|
||||
"build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup && yarn run contexts:rollup && yarn run create-bot-whatsapp:rollup",
|
||||
"copy.lib": "node ./scripts/move.js",
|
||||
"test.unit": "node ./node_modules/uvu/bin.js packages test",
|
||||
"test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit",
|
||||
@@ -29,7 +30,7 @@
|
||||
"prepare": "npx husky install",
|
||||
"preinstall": "npx only-allow yarn",
|
||||
"postinstall": "npx prettier --write .",
|
||||
"release": "standard-version -- --prerelease"
|
||||
"release": "standard-version -- --prerelease --global"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/create-bot-whatsapp",
|
||||
@@ -37,6 +38,7 @@
|
||||
"packages/cli",
|
||||
"packages/database",
|
||||
"packages/provider",
|
||||
"packages/contexts",
|
||||
"packages/docs"
|
||||
],
|
||||
"keywords": [
|
||||
|
||||
@@ -58,13 +58,13 @@ class CoreClass {
|
||||
]
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} messageInComming
|
||||
* GLOSSARY.md
|
||||
* @param {*} messageCtxInComming
|
||||
* @returns
|
||||
*/
|
||||
handleMsg = async (messageInComming) => {
|
||||
logger.log(`[handleMsg]: `, messageInComming)
|
||||
const { body, from } = messageInComming
|
||||
handleMsg = async (messageCtxInComming) => {
|
||||
logger.log(`[handleMsg]: `, messageCtxInComming)
|
||||
const { body, from } = messageCtxInComming
|
||||
let msgToSend = []
|
||||
let fallBackFlag = false
|
||||
|
||||
@@ -84,7 +84,7 @@ class CoreClass {
|
||||
this.databaseClass.save(ctxByNumber)
|
||||
}
|
||||
|
||||
// 📄 [options: fallback]: esta funcion se encarga de repetir el ultimo mensaje
|
||||
// 📄 [options: fallBack]: esta funcion se encarga de repetir el ultimo mensaje
|
||||
const fallBack = () => {
|
||||
fallBackFlag = true
|
||||
msgToSend = this.flowClass.find(refToContinue?.keyword, true) || []
|
||||
@@ -92,14 +92,43 @@ class CoreClass {
|
||||
return refToContinue
|
||||
}
|
||||
|
||||
// 📄 [options: callback]: Si se tiene un callback se ejecuta
|
||||
if (!fallBackFlag && refToContinue && prevMsg?.options?.callback) {
|
||||
const indexFlow = this.flowClass.findIndexByRef(refToContinue?.ref)
|
||||
this.flowClass.allCallbacks[indexFlow].callback(messageInComming, {
|
||||
// 📄 [options: flowDynamic]: esta funcion se encarga de responder un array de respuesta esta limitado a 5 mensajes
|
||||
// para evitar bloque de whatsapp
|
||||
const flowDynamic = (listMsg = [], optListMsg = { limit: 3 }) => {
|
||||
if (!Array.isArray(listMsg))
|
||||
throw new Error('Esto debe ser un ARRAY')
|
||||
|
||||
const parseListMsg = listMsg
|
||||
.map(({ body }, index) =>
|
||||
toCtx({
|
||||
body,
|
||||
from,
|
||||
keyword: null,
|
||||
index,
|
||||
})
|
||||
)
|
||||
.slice(0, optListMsg.limit)
|
||||
msgToSend = parseListMsg
|
||||
this.sendFlow(msgToSend, from)
|
||||
return
|
||||
}
|
||||
|
||||
// 📄 Se encarga de revisar si el contexto del mensaje tiene callback y ejecutarlo
|
||||
const cbEveryCtx = (inRef) => {
|
||||
this.flowClass.allCallbacks[inRef](messageCtxInComming, {
|
||||
fallBack,
|
||||
flowDynamic,
|
||||
})
|
||||
}
|
||||
|
||||
// 📄 [options: callback]: Si se tiene un callback se ejecuta
|
||||
if (!fallBackFlag) {
|
||||
if (refToContinue?.options?.capture) cbEveryCtx(refToContinue?.ref)
|
||||
for (const ite of this.flowClass.find(body)) {
|
||||
if (!ite?.options?.capture) cbEveryCtx(ite?.ref)
|
||||
}
|
||||
}
|
||||
|
||||
// 📄🤘(tiene return) [options: nested(array)]: Si se tiene flujos hijos los implementa
|
||||
if (!fallBackFlag && prevMsg?.options?.nested?.length) {
|
||||
const nestedRef = prevMsg.options.nested
|
||||
@@ -108,6 +137,11 @@ class CoreClass {
|
||||
}))
|
||||
|
||||
msgToSend = this.flowClass.find(body, false, flowStandalone) || []
|
||||
|
||||
for (const ite of msgToSend) {
|
||||
cbEveryCtx(ite?.ref)
|
||||
}
|
||||
|
||||
this.sendFlow(msgToSend, from)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { toSerialize } = require('./methods/toSerialize')
|
||||
const { flatObject } = require('../utils/flattener')
|
||||
|
||||
class FlowClass {
|
||||
allCallbacks = []
|
||||
@@ -8,10 +9,7 @@ class FlowClass {
|
||||
if (!Array.isArray(_flow)) throw new Error('Esto debe ser un ARRAY')
|
||||
this.flowRaw = _flow
|
||||
|
||||
this.allCallbacks = _flow
|
||||
.map((cbIn) => cbIn.ctx.callbacks)
|
||||
.flat(2)
|
||||
.map((c, i) => ({ callback: c?.callback, index: i }))
|
||||
this.allCallbacks = flatObject(_flow)
|
||||
|
||||
const mergeToJsonSerialize = Object.keys(_flow)
|
||||
.map((indexObjectFlow) => _flow[indexObjectFlow].toJson())
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
const { flatObject } = require('../../utils/flattener')
|
||||
const { generateRef } = require('../../utils/hash')
|
||||
const { addChild } = require('./addChild')
|
||||
const { toJson } = require('./toJson')
|
||||
/**
|
||||
*
|
||||
@@ -27,14 +29,30 @@ const addAnswer =
|
||||
delay: typeof options?.delay === 'number' ? options?.delay : 0,
|
||||
})
|
||||
|
||||
const getNested = () => ({
|
||||
nested: Array.isArray(nested) ? nested : [],
|
||||
})
|
||||
const getNested = () => {
|
||||
let flatNested = []
|
||||
if (Array.isArray(nested)) {
|
||||
for (const iterator of nested) {
|
||||
flatNested = [...flatNested, ...addChild(iterator)]
|
||||
}
|
||||
|
||||
const callback =
|
||||
typeof cb === 'function'
|
||||
? cb
|
||||
: () => console.log('Callback no definida')
|
||||
return {
|
||||
nested: flatNested,
|
||||
}
|
||||
}
|
||||
return {
|
||||
nested: addChild(nested),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Esta funcion aplana y busca los callback anidados de los hijos
|
||||
* @returns
|
||||
*/
|
||||
const getCbFromNested = () =>
|
||||
flatObject(Array.isArray(nested) ? nested : [nested])
|
||||
|
||||
const callback = typeof cb === 'function' ? cb : () => null
|
||||
|
||||
const lastCtx = inCtx.hasOwnProperty('ctx') ? inCtx.ctx : inCtx
|
||||
|
||||
@@ -62,12 +80,12 @@ const addAnswer =
|
||||
},
|
||||
])
|
||||
|
||||
const callbacks = [].concat(inCtx.callbacks).concat([
|
||||
{
|
||||
ref: lastCtx.ref,
|
||||
callback,
|
||||
},
|
||||
])
|
||||
getCbFromNested()
|
||||
const callbacks = {
|
||||
...inCtx.callbacks,
|
||||
...getCbFromNested(),
|
||||
[ref]: callback,
|
||||
}
|
||||
|
||||
return {
|
||||
...lastCtx,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/bot",
|
||||
"version": "0.0.21-alpha.0",
|
||||
"version": "0.0.41-alpha.0",
|
||||
"description": "",
|
||||
"main": "./lib/bundle.bot.cjs",
|
||||
"scripts": {
|
||||
|
||||
@@ -3,14 +3,23 @@ const commonjs = require('@rollup/plugin-commonjs')
|
||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||
const { join } = require('path')
|
||||
|
||||
const PATH = join(__dirname, 'lib', 'bundle.bot.cjs')
|
||||
|
||||
module.exports = {
|
||||
input: join(__dirname, 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: PATH,
|
||||
format: 'cjs',
|
||||
module.exports = [
|
||||
{
|
||||
input: join(__dirname, 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'bundle.bot.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs(), nodeResolve()],
|
||||
},
|
||||
plugins: [commonjs(), nodeResolve()],
|
||||
}
|
||||
{
|
||||
input: join(__dirname, 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'bundle.bot.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs(), nodeResolve()],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@ const {
|
||||
} = require('../index')
|
||||
|
||||
class MockFlow {
|
||||
allCallbacks = [{ callback: () => console.log('') }]
|
||||
allCallbacks = { ref: () => 1 }
|
||||
flowSerialize = []
|
||||
flowRaw = []
|
||||
find = (arg) => {
|
||||
|
||||
25
packages/bot/utils/flattener.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const flatObject = (listArray = []) => {
|
||||
const cbNestedList = Array.isArray(listArray) ? listArray : []
|
||||
|
||||
if (!listArray.length) return {}
|
||||
|
||||
const cbNestedObj = cbNestedList
|
||||
.map(({ ctx }) => ctx?.callbacks)
|
||||
.filter((i) => !!i)
|
||||
const queueCb = cbNestedObj.reduce((acc, current) => {
|
||||
const getKeys = Object.keys(current)
|
||||
const parse = getKeys.map((icb, i) => ({
|
||||
[icb]: Object.values(current)[i],
|
||||
}))
|
||||
return [...acc, ...parse]
|
||||
}, [])
|
||||
|
||||
const flatObj = {}
|
||||
for (const iteration of queueCb) {
|
||||
const [keyCb] = Object.keys(iteration)
|
||||
flatObj[keyCb] = iteration[keyCb]
|
||||
}
|
||||
return flatObj
|
||||
}
|
||||
|
||||
module.exports = { flatObject }
|
||||
@@ -1,8 +1,8 @@
|
||||
const prompts = require('prompts')
|
||||
const { yellow, red, cyan, bgMagenta } = require('kleur')
|
||||
const { copyBaseApp } = require('../create-app')
|
||||
const { join } = require('path')
|
||||
const { yellow, red, cyan, bgMagenta } = require('kleur')
|
||||
const { existsSync } = require('fs')
|
||||
const { copyBaseApp } = require('../create-app')
|
||||
const { checkNodeVersion, checkOs } = require('../check')
|
||||
|
||||
const bannerDone = () => {
|
||||
@@ -12,7 +12,7 @@ const bannerDone = () => {
|
||||
[
|
||||
`[Agradecimientos]: Este es un proyecto OpenSource, si tienes intenciones de colaborar puedes hacerlo:`,
|
||||
`[😉] Comprando un cafe https://www.buymeacoffee.com/leifermendez`,
|
||||
`[⭐] Dar estrella https://github.com/leifermendez/bot-whatsapp`,
|
||||
`[⭐] Dar estrella https://github.com/codigoencasa/bot-whatsapp`,
|
||||
`[🚀] Realizando mejoras en el codigo`,
|
||||
].join('\n')
|
||||
)
|
||||
@@ -33,10 +33,10 @@ const startInteractive = async () => {
|
||||
message: '¿Cuál proveedor de whatsapp quieres utilizar?',
|
||||
choices: [
|
||||
{ title: 'whatsapp-web.js (gratis)', value: 'wweb' },
|
||||
{ title: 'Twilio', value: 'twilio' },
|
||||
{ title: 'Venom (gratis)', value: 'venom' },
|
||||
{ title: 'Baileys (gratis)', value: 'bailey', disabled: true },
|
||||
{ title: 'API Oficial (Meta)', value: 'meta', disabled: true },
|
||||
{ title: 'Baileys (gratis)', value: 'baileys' },
|
||||
{ title: 'Twilio', value: 'twilio' },
|
||||
{ title: 'API Oficial (Meta)', value: 'meta' },
|
||||
],
|
||||
max: 1,
|
||||
hint: 'Espacio para seleccionar',
|
||||
@@ -48,9 +48,9 @@ const startInteractive = async () => {
|
||||
message: '¿Cuál base de datos quieres utilizar?',
|
||||
choices: [
|
||||
{ title: 'Memory', value: 'memory' },
|
||||
{ title: 'Json', value: 'json' },
|
||||
{ title: 'Mongo', value: 'mongo' },
|
||||
{ title: 'MySQL', value: 'mysql' },
|
||||
{ title: 'Json', value: 'json', disabled: true },
|
||||
],
|
||||
max: 1,
|
||||
hint: 'Espacio para seleccionar',
|
||||
@@ -85,7 +85,7 @@ const startInteractive = async () => {
|
||||
const indexOfPath = possiblesPath.find((a) => existsSync(a))
|
||||
await copyBaseApp(indexOfPath, join(process.cwd(), templateName))
|
||||
console.log(``)
|
||||
console.log(bgMagenta(`⚡⚡⚡INSTRUCCIONES⚡⚡⚡`))
|
||||
console.log(bgMagenta(`⚡⚡⚡ INSTRUCCIONES ⚡⚡⚡`))
|
||||
console.log(yellow(`cd ${templateName}`))
|
||||
console.log(yellow(`npm install`))
|
||||
console.log(yellow(`npm start`))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/cli",
|
||||
"version": "0.0.28-alpha.0",
|
||||
"version": "0.0.48-alpha.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
|
||||
17
packages/contexts/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/contexts",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "./lib/bundle.contexts.cjs",
|
||||
"files": [
|
||||
"./lib/"
|
||||
],
|
||||
"exports": {
|
||||
"./mock": "./lib/mock/index.cjs",
|
||||
"./dialogflow": "./lib/dialogflow/index.cjs",
|
||||
"./dialogflowcx": "./lib/dialogflow-cx/index.cjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bot-whatsapp/bot": "*"
|
||||
}
|
||||
}
|
||||
33
packages/contexts/rollup-contexts.config.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const banner = require('../../config/banner.rollup.json')
|
||||
const commonjs = require('@rollup/plugin-commonjs')
|
||||
const { join } = require('path')
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
input: join(__dirname, 'src', 'mock', 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'mock', 'index.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs()],
|
||||
},
|
||||
{
|
||||
input: join(__dirname, 'src', 'dialogflow', 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'dialogflow', 'index.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs()],
|
||||
},
|
||||
{
|
||||
input: join(__dirname, 'src', 'dialogflow-cx', 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'dialogflow-cx', 'index.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs()],
|
||||
},
|
||||
]
|
||||
124
packages/contexts/src/dialogflow-cx/dialogflow-cx.class.js
Normal file
@@ -0,0 +1,124 @@
|
||||
const { CoreClass } = require('@bot-whatsapp/bot')
|
||||
const { SessionsClient } = require('@google-cloud/dialogflow-cx').v3beta1
|
||||
const { existsSync, readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
/**
|
||||
* Necesita extender de core.class
|
||||
* handleMsg(messageInComming) // const { body, from } = messageInComming
|
||||
*/
|
||||
|
||||
const GOOGLE_ACCOUNT_PATH = join(process.cwd(), 'google-key.json')
|
||||
|
||||
class DialogFlowCXContext extends CoreClass {
|
||||
// Opciones del usuario
|
||||
optionsDX = {
|
||||
language: 'es',
|
||||
location: '',
|
||||
agentId: '',
|
||||
}
|
||||
projectId = null
|
||||
configuration = null
|
||||
sessionClient = null
|
||||
|
||||
constructor(_database, _provider, _optionsDX = {}) {
|
||||
super(null, _database, _provider)
|
||||
this.optionsDX = { ...this.optionsDX, ..._optionsDX }
|
||||
this.init()
|
||||
}
|
||||
|
||||
/**
|
||||
* Verificar conexión con servicio de DialogFlow
|
||||
*/
|
||||
init = () => {
|
||||
if (!existsSync(GOOGLE_ACCOUNT_PATH)) {
|
||||
console.log(`[ERROR]: No se encontro ${GOOGLE_ACCOUNT_PATH}`)
|
||||
/**
|
||||
* Emitir evento de error para que se mueste por consola dicinedo que no tiene el json
|
||||
* */
|
||||
}
|
||||
|
||||
if (!this.optionsDX.location.length)
|
||||
throw new Error('LOCATION_NO_ENCONTRADO')
|
||||
if (!this.optionsDX.agentId.length)
|
||||
throw new Error('AGENTID_NO_ENCONTRADO')
|
||||
|
||||
const rawJson = readFileSync(GOOGLE_ACCOUNT_PATH, 'utf-8')
|
||||
const { project_id, private_key, client_email } = JSON.parse(rawJson)
|
||||
|
||||
this.projectId = project_id
|
||||
|
||||
this.sessionClient = new SessionsClient({
|
||||
credentials: { private_key, client_email },
|
||||
apiEndpoint: `${this.optionsDX.location}-dialogflow.googleapis.com`,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* GLOSSARY.md
|
||||
* @param {*} messageCtxInComming
|
||||
* @returns
|
||||
*/
|
||||
handleMsg = async (messageCtxInComming) => {
|
||||
const languageCode = this.optionsDX.language
|
||||
const { from, body } = messageCtxInComming
|
||||
|
||||
/**
|
||||
* 📄 Creamos session de contexto basado en el numero de la persona
|
||||
* para evitar este problema.
|
||||
* https://github.com/codigoencasa/bot-whatsapp/pull/140
|
||||
*/
|
||||
|
||||
const session = this.sessionClient.projectLocationAgentSessionPath(
|
||||
this.projectId,
|
||||
this.optionsDX.location,
|
||||
this.optionsDX.agentId,
|
||||
from
|
||||
)
|
||||
|
||||
const reqDialog = {
|
||||
session,
|
||||
queryInput: {
|
||||
text: {
|
||||
text: body,
|
||||
},
|
||||
languageCode,
|
||||
},
|
||||
}
|
||||
|
||||
const [single] = (await this.sessionClient.detectIntent(reqDialog)) || [
|
||||
null,
|
||||
]
|
||||
|
||||
const listMessages = single.queryResult.responseMessages.map((res) => {
|
||||
if (res.message == 'text') {
|
||||
return { answer: res.text.text[0] }
|
||||
}
|
||||
|
||||
if (res.message == 'payload') {
|
||||
const {
|
||||
media = null,
|
||||
buttons = [],
|
||||
answer = '',
|
||||
} = res.payload.fields
|
||||
const buttonsArray = buttons?.listValue?.values?.map(
|
||||
(btnValue) => {
|
||||
const { stringValue } = btnValue.structValue.fields.body
|
||||
return { body: stringValue }
|
||||
}
|
||||
)
|
||||
return {
|
||||
answer: answer?.stringValue,
|
||||
options: {
|
||||
media: media?.stringValue,
|
||||
buttons: buttonsArray,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
this.sendFlow(listMessages, from)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DialogFlowCXContext
|
||||
14
packages/contexts/src/dialogflow-cx/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const DialogCXFlowClass = require('./dialogflow-cx.class')
|
||||
|
||||
/**
|
||||
* Crear instancia de clase Bot
|
||||
* @param {*} args
|
||||
* @returns
|
||||
*/
|
||||
const createBotDialog = async ({ database, provider }, _options) =>
|
||||
new DialogCXFlowClass(database, provider, _options)
|
||||
|
||||
module.exports = {
|
||||
createBotDialog,
|
||||
DialogCXFlowClass,
|
||||
}
|
||||
114
packages/contexts/src/dialogflow/dialogflow.class.js
Normal file
@@ -0,0 +1,114 @@
|
||||
const { CoreClass } = require('@bot-whatsapp/bot')
|
||||
const dialogflow = require('@google-cloud/dialogflow')
|
||||
const { existsSync, readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
/**
|
||||
* Necesita extender de core.class
|
||||
* handleMsg(messageInComming) // const { body, from } = messageInComming
|
||||
*/
|
||||
|
||||
const GOOGLE_ACCOUNT_PATH = join(process.cwd(), 'google-key.json')
|
||||
|
||||
class DialogFlowContext extends CoreClass {
|
||||
projectId = null
|
||||
configuration = null
|
||||
sessionClient = null
|
||||
optionsDX = {
|
||||
language: 'es',
|
||||
}
|
||||
|
||||
constructor(_database, _provider, _optionsDX = {}) {
|
||||
super(null, _database, _provider)
|
||||
this.optionsDX = { ...this.optionsDX, ..._optionsDX }
|
||||
this.init()
|
||||
}
|
||||
|
||||
/**
|
||||
* Verificar conexión con servicio de DialogFlow
|
||||
*/
|
||||
init = () => {
|
||||
if (!existsSync(GOOGLE_ACCOUNT_PATH)) {
|
||||
console.log(`[ERROR]: No se encontro ${GOOGLE_ACCOUNT_PATH}`)
|
||||
/**
|
||||
* Emitir evento de error para que se mueste por consola dicinedo que no tiene el json
|
||||
* */
|
||||
}
|
||||
|
||||
const rawJson = readFileSync(GOOGLE_ACCOUNT_PATH, 'utf-8')
|
||||
const { project_id, private_key, client_email } = JSON.parse(rawJson)
|
||||
|
||||
this.projectId = project_id
|
||||
this.configuration = {
|
||||
credentials: {
|
||||
private_key,
|
||||
client_email,
|
||||
},
|
||||
}
|
||||
|
||||
this.sessionClient = new dialogflow.SessionsClient(this.configuration)
|
||||
}
|
||||
|
||||
/**
|
||||
* GLOSSARY.md
|
||||
* @param {*} messageCtxInComming
|
||||
* @returns
|
||||
*/
|
||||
handleMsg = async (messageCtxInComming) => {
|
||||
const languageCode = this.optionsDX.language
|
||||
const { from, body } = messageCtxInComming
|
||||
|
||||
let customPayload = {}
|
||||
|
||||
/**
|
||||
* 📄 Creamos session de contexto basado en el numero de la persona
|
||||
* para evitar este problema.
|
||||
* https://github.com/codigoencasa/bot-whatsapp/pull/140
|
||||
*/
|
||||
const session = this.sessionClient.projectAgentSessionPath(
|
||||
this.projectId,
|
||||
from
|
||||
)
|
||||
const reqDialog = {
|
||||
session,
|
||||
queryInput: {
|
||||
text: {
|
||||
text: body,
|
||||
languageCode,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const [single] = (await this.sessionClient.detectIntent(reqDialog)) || [
|
||||
null,
|
||||
]
|
||||
|
||||
const { queryResult } = single
|
||||
|
||||
const msgPayload = queryResult?.fulfillmentMessages?.find(
|
||||
(a) => a.message === 'payload'
|
||||
)
|
||||
|
||||
// Revisamos si el dialogFlow tiene multimedia
|
||||
if (msgPayload && msgPayload?.payload) {
|
||||
const { fields } = msgPayload.payload
|
||||
const mapButtons = fields?.buttons?.listValue?.values.map((m) => {
|
||||
return { body: m?.structValue?.fields?.body?.stringValue }
|
||||
})
|
||||
|
||||
customPayload = {
|
||||
media: fields?.media?.stringValue,
|
||||
buttons: mapButtons,
|
||||
}
|
||||
}
|
||||
|
||||
const ctxFromDX = {
|
||||
...customPayload,
|
||||
answer: queryResult?.fulfillmentText,
|
||||
}
|
||||
|
||||
this.sendFlow([ctxFromDX], from)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DialogFlowContext
|
||||
14
packages/contexts/src/dialogflow/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const DialogFlowClass = require('./dialogflow.class')
|
||||
|
||||
/**
|
||||
* Crear instancia de clase Bot
|
||||
* @param {*} args
|
||||
* @returns
|
||||
*/
|
||||
const createBotDialog = async ({ database, provider }) =>
|
||||
new DialogFlowClass(database, provider)
|
||||
|
||||
module.exports = {
|
||||
createBotDialog,
|
||||
DialogFlowClass,
|
||||
}
|
||||
14
packages/contexts/src/mock/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const MockClass = require('./mock.class')
|
||||
|
||||
/**
|
||||
* Crear instancia de clase Bot
|
||||
* @param {*} args
|
||||
* @returns
|
||||
*/
|
||||
const createBotMock = async ({ database, provider }) =>
|
||||
new MockClass(database, provider)
|
||||
|
||||
module.exports = {
|
||||
createBotMock,
|
||||
MockClass,
|
||||
}
|
||||
24
packages/contexts/src/mock/mock.class.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { CoreClass } = require('@bot-whatsapp/bot')
|
||||
/**
|
||||
* Necesita extender de core.class
|
||||
* handleMsg(messageInComming) // const { body, from } = messageInComming
|
||||
*/
|
||||
|
||||
class MockContext extends CoreClass {
|
||||
constructor(_database, _provider) {
|
||||
super(null, _database, _provider)
|
||||
}
|
||||
|
||||
init = () => {}
|
||||
|
||||
/**
|
||||
* GLOSSARY.md
|
||||
* @param {*} messageCtxInComming
|
||||
* @returns
|
||||
*/
|
||||
handleMsg = async () => {
|
||||
console.log('DEBUG:')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MockContext
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-bot-whatsapp",
|
||||
"version": "0.0.39-alpha.0",
|
||||
"version": "0.0.59-alpha.0",
|
||||
"description": "",
|
||||
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/database",
|
||||
"version": "0.0.20-alpha.0",
|
||||
"version": "0.0.40-alpha.0",
|
||||
"description": "Esto es el conector a mysql, pg, mongo",
|
||||
"main": "./lib/mock/index.cjs",
|
||||
"keywords": [],
|
||||
@@ -12,13 +12,12 @@
|
||||
"dependencies": {
|
||||
"dotenv": "^16.0.3",
|
||||
"mongodb": "^4.11.0",
|
||||
"mysql2": "^2.3.3",
|
||||
"stormdb": "^0.6.0"
|
||||
"mysql2": "^2.3.3"
|
||||
},
|
||||
"exports": {
|
||||
"./mock": "./lib/mock/index.cjs",
|
||||
"./mongo": "./lib/mongo/index.cjs",
|
||||
"./json-file": "./lib/json-file/index.cjs",
|
||||
"./json": "./lib/json/index.cjs",
|
||||
"./mysql": "./lib/mysql/index.cjs"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,11 @@ module.exports = [
|
||||
plugins: [commonjs()],
|
||||
},
|
||||
{
|
||||
input: join(__dirname, 'src', 'json-file', 'index.js'),
|
||||
input: join(__dirname, 'src', 'json', 'index.js'),
|
||||
output: {
|
||||
banner: banner['banner.output'].join(''),
|
||||
file: join(__dirname, 'lib', 'json-file', 'index.cjs'),
|
||||
file: join(__dirname, 'lib', 'json', 'index.cjs'),
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [commonjs()],
|
||||
},
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
const path = require('path')
|
||||
const StormDB = require('stormdb')
|
||||
const engine = new StormDB.localFileEngine(
|
||||
path.join(process.cwd(), './db.stormdb')
|
||||
)
|
||||
|
||||
class JsonFileAdapter {
|
||||
db
|
||||
listHistory = []
|
||||
|
||||
constructor() {
|
||||
this.init().then()
|
||||
}
|
||||
|
||||
init() {
|
||||
return new Promise((resolve) => {
|
||||
this.db = new StormDB(engine)
|
||||
this.db.default({ history: [] })
|
||||
resolve(this.db)
|
||||
})
|
||||
}
|
||||
|
||||
getPrevByNumber = async (from) => {
|
||||
const response = await this.db.get('history')
|
||||
const { history } = response.state
|
||||
|
||||
if (!history.length) {
|
||||
return null
|
||||
}
|
||||
|
||||
const result = history.filter((res) => res.from === from).pop()
|
||||
|
||||
return {
|
||||
...result,
|
||||
}
|
||||
}
|
||||
|
||||
save = async (ctx) => {
|
||||
await this.db
|
||||
.get('history')
|
||||
.push({ ...ctx })
|
||||
.save()
|
||||
console.log('Guardado en DB...', ctx)
|
||||
this.listHistory.push(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JsonFileAdapter
|
||||
64
packages/database/src/json/index.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const { join } = require('path')
|
||||
const { existsSync, writeFileSync, readFileSync } = require('fs')
|
||||
|
||||
class JsonFileAdapter {
|
||||
db
|
||||
pathFile
|
||||
listHistory = []
|
||||
|
||||
constructor() {
|
||||
this.pathFile = join(process.cwd(), 'db.json')
|
||||
this.init().then()
|
||||
}
|
||||
|
||||
databaseExists() {
|
||||
return existsSync(this.pathFile)
|
||||
}
|
||||
|
||||
async init() {
|
||||
const dbExists = await this.databaseExists()
|
||||
|
||||
if (!dbExists) {
|
||||
const data = {
|
||||
history: [],
|
||||
}
|
||||
await this.saveData(data)
|
||||
}
|
||||
}
|
||||
|
||||
readDatabase() {
|
||||
const db = readFileSync(this.pathFile)
|
||||
return JSON.parse(db)
|
||||
}
|
||||
|
||||
saveData(data) {
|
||||
writeFileSync(this.pathFile, JSON.stringify(data, null, 2))
|
||||
}
|
||||
|
||||
getPrevByNumber = async (from) => {
|
||||
const { history } = await this.readDatabase()
|
||||
|
||||
if (!history.length) {
|
||||
return null
|
||||
}
|
||||
|
||||
const result = history.filter((res) => res.from === from).pop()
|
||||
|
||||
return {
|
||||
...result,
|
||||
}
|
||||
}
|
||||
|
||||
save = async (ctx) => {
|
||||
this.db = await this.readDatabase()
|
||||
|
||||
this.db.history.push(ctx)
|
||||
|
||||
await this.saveData(this.db)
|
||||
|
||||
this.listHistory.push(ctx)
|
||||
console.log('Guardado en DB...', ctx)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = JsonFileAdapter
|
||||
@@ -1,23 +1,20 @@
|
||||
require('dotenv').config()
|
||||
const { MongoClient } = require('mongodb')
|
||||
|
||||
const DB_URI = process.env.DB_URI || 'mongodb://0.0.0.0:27017'
|
||||
const DB_NAME = process.env.DB_NAME || 'db_bot'
|
||||
|
||||
class MongoAdapter {
|
||||
db
|
||||
listHistory = []
|
||||
|
||||
constructor() {
|
||||
credentials = { dbUri: null, dbName: null }
|
||||
constructor(_credentials) {
|
||||
this.credentials = _credentials
|
||||
this.init().then()
|
||||
}
|
||||
|
||||
init = async () => {
|
||||
try {
|
||||
const client = new MongoClient(DB_URI, {})
|
||||
const client = new MongoClient(this.credentials.dbUri, {})
|
||||
await client.connect()
|
||||
console.log('🆗 Conexión Correcta DB')
|
||||
const db = client.db(DB_NAME)
|
||||
const db = client.db(this.credentials.dbName)
|
||||
this.db = db
|
||||
return true
|
||||
} catch (e) {
|
||||
|
||||
@@ -3,7 +3,7 @@ const mysql = require('mysql2')
|
||||
class MyslAdapter {
|
||||
db
|
||||
listHistory = []
|
||||
credentials = { host: null, user: null, database: null }
|
||||
credentials = { host: null, user: null, database: null, password: null }
|
||||
|
||||
constructor(_credentials) {
|
||||
this.credentials = _credentials
|
||||
|
||||
@@ -6,35 +6,35 @@ module.exports = {
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:qwik/recommended',
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:qwik/recommended",
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json'],
|
||||
project: ["./tsconfig.json"],
|
||||
ecmaVersion: 2021,
|
||||
sourceType: 'module',
|
||||
sourceType: "module",
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
plugins: ['@typescript-eslint'],
|
||||
plugins: ["@typescript-eslint"],
|
||||
rules: {
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-inferrable-types': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-this-alias': 'off',
|
||||
'@typescript-eslint/ban-types': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': 'off',
|
||||
'prefer-spread': 'off',
|
||||
'no-case-declarations': 'off',
|
||||
'no-console': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['error'],
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-empty-interface": "off",
|
||||
"@typescript-eslint/no-namespace": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-this-alias": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"prefer-spread": "off",
|
||||
"no-case-declarations": "off",
|
||||
"no-console": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["error"],
|
||||
},
|
||||
};
|
||||
|
||||
7
packages/docs/.gitignore
vendored
@@ -5,7 +5,7 @@
|
||||
/server
|
||||
|
||||
# Development
|
||||
node_modules
|
||||
node_modules/
|
||||
|
||||
# Cache
|
||||
.cache
|
||||
@@ -37,5 +37,10 @@ lerna-debug.log*
|
||||
.yarn/*
|
||||
!.yarn/releases
|
||||
|
||||
package-lock.json
|
||||
|
||||
# Cloudflare
|
||||
functions/**/*.js
|
||||
|
||||
# Netlify
|
||||
.netlify
|
||||
|
||||
6
packages/docs/.stackblitzrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"startCommand": "npm start",
|
||||
"env": {
|
||||
"ENABLE_CJS_IMPORTS": true
|
||||
}
|
||||
}
|
||||
21
packages/docs/LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 onWidget
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,11 +1,356 @@
|
||||
### 😎 Documentación Bot-Whatsapp
|
||||
# 💠 Qwind
|
||||
|
||||
👉 [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
||||
**Qwind** is a free and open-source template to make your website using **[Qwik](https://qwik.builder.io/) + [Tailwind CSS](https://tailwindcss.com/)**. Ready to start a new project and designed taking into account best practices.
|
||||
|
||||
Se esta iniciando una documentación oficial sobre como usar e implementar los diferentes funcionalidades del bot-wahtsapp
|
||||
## Features
|
||||
|
||||
- ✅ Integration with **Tailwind CSS** supporting **Dark mode**.
|
||||
- ✅ **Production-ready** scores in [Lighthouse](https://web.dev/measure/) and [PageSpeed Insights](https://pagespeed.web.dev/) reports.
|
||||
- ✅ **Image optimization** and **Font optimization**.
|
||||
|
||||
La idea es cada usuario pueda ir aportando a la documentacion y formar parte de este proyecto.
|
||||
<br>
|
||||
|
||||
<img src="./screenshot.jpg" alt="Qwind Theme Screenshot">
|
||||
|
||||
##### ¿Como agregar documentación? [Video]
|
||||
[](https://onwidget.com)
|
||||
[](https://github.com/onwidget/qwind/blob/main/LICENSE.md)
|
||||
[](https://github.com/onwidget)
|
||||
[](https://github.com/onwidget/qwind#contributing)
|
||||
[](https://snyk.io/test/github/onwidget/qwind)
|
||||
|
||||
<br>
|
||||
|
||||
<details open>
|
||||
<summary>Table of Contents</summary>
|
||||
|
||||
- [Demo](#demo)
|
||||
- [Getting started](#getting-started)
|
||||
- [Project structure](#project-structure)
|
||||
- [Commands](#commands)
|
||||
- [Configuration](#configuration)
|
||||
- [Deploy](#deploy)
|
||||
- [Roadmap](#roadmap)
|
||||
- [Contributing](#contributing)
|
||||
- [Acknowledgements](#acknowledgements)
|
||||
- [License](#license)
|
||||
|
||||
</details>
|
||||
|
||||
<br>
|
||||
|
||||
## Demo
|
||||
|
||||
📌 [https://qwind.pages.dev/](https://qwind.pages.dev/)
|
||||
|
||||
<br>
|
||||
|
||||
## Getting started
|
||||
|
||||
This project is using Qwik with [QwikCity](https://qwik.builder.io/qwikcity/overview/). QwikCity is just a extra set of tools on top of Qwik to make it easier to build a full site, including directory-based routing, layouts, and more.
|
||||
|
||||
### Project structure
|
||||
|
||||
Inside **Qwind** template, you'll see the following folders and files:
|
||||
|
||||
```
|
||||
/
|
||||
├── adaptors/
|
||||
| └── static/
|
||||
| └── vite.config.ts
|
||||
├── public/
|
||||
│ ├── favicon.svg
|
||||
│ ├── manifest.json
|
||||
│ └── robots.txt
|
||||
├── src/
|
||||
│ ├── assets/
|
||||
│ │ ├── images/
|
||||
| | └── styles/
|
||||
| | └── global.css
|
||||
│ ├── components/
|
||||
│ │ ├── atoms/
|
||||
│ │ ├── core/
|
||||
│ │ ├── icons/
|
||||
| | └── widgets/
|
||||
| | ├── Header.astro
|
||||
| | ├── Footer.astro
|
||||
| | └── ...
|
||||
│ ├── routes/
|
||||
│ | ├── blog/
|
||||
│ | ├── index.astro
|
||||
| | ├── layout.tsx
|
||||
| | └-- service-worker.ts
|
||||
│ ├── config.mjs
|
||||
│ ├── entry.dev.tsx
|
||||
│ ├── entry.preview.tsx
|
||||
│ ├── entry.ssr.tsx
|
||||
│ └── root.tsx
|
||||
├── package.json
|
||||
└── ...
|
||||
```
|
||||
|
||||
- `src/routes`: Provides the directory based routing, which can include a hierarchy of `layout.tsx` layout files, and an `index.tsx` file as the page. Additionally, `index.ts` files are endpoints. Please see the [routing docs](https://qwik.builder.io/qwikcity/routing/overview/) for more info.
|
||||
|
||||
- `src/components`: Recommended directory for components.
|
||||
|
||||
- `public`: Any static assets, like images, can be placed in the public directory. Please see the [Vite public directory](https://vitejs.dev/guide/assets.html#the-public-directory) for more info.
|
||||
|
||||
[](https://githubbox.com/onwidget/qwind/tree/main)
|
||||
|
||||
> **Seasoned qwik expert?** Delete this file. Update `config.mjs` and contents. Have fun!
|
||||
|
||||
<br>
|
||||
|
||||
### Commands
|
||||
|
||||
All commands are run from the root of the project, from a terminal:
|
||||
|
||||
| Command | Action |
|
||||
| :-------------------- | :------------------------------------------------- |
|
||||
| `npm install` | Installs dependencies |
|
||||
| `npm run dev` | Starts local dev server at `127.0.0.1:5173/` |
|
||||
| `npm run build` | Build your production site to `./dist/` |
|
||||
| `npm run preview` | Preview your build locally, before deploying |
|
||||
| `npm run fmt` | Format codes with Prettier |
|
||||
| `npm run lint` | Run Eslint |
|
||||
| `npm run qwik ...` | Run CLI commands like `qwik add`, `qwik build` |
|
||||
|
||||
<br>
|
||||
|
||||
### Configuration
|
||||
|
||||
Basic configuration file: `./src/config.mjs`
|
||||
|
||||
```javascript
|
||||
export const SITE = {
|
||||
name: 'Example',
|
||||
|
||||
origin: 'https://example.com',
|
||||
basePathname: '/', // Change this if you need to deploy to Github Pages, for example
|
||||
trailingSlash: true, // Generate permalinks with or without "/" at the end
|
||||
};
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### Deploy
|
||||
|
||||
#### Deploy to production (manual)
|
||||
|
||||
You can create an optimized production build with:
|
||||
|
||||
```shell
|
||||
npm run build
|
||||
```
|
||||
|
||||
Now, your website is ready to be deployed. All generated files are located at
|
||||
`dist` folder, which you can deploy the folder to any hosting service you
|
||||
prefer.
|
||||
|
||||
#### Deploy to Netlify
|
||||
|
||||
Clone this repository on own GitHub account and deploy to Netlify:
|
||||
|
||||
[](https://app.netlify.com/start/deploy?repository=https://github.com/onwidget/qwind)
|
||||
|
||||
#### Deploy to Vercel
|
||||
|
||||
Clone this repository on own GitHub account and deploy to Vercel:
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fonwidget%2Fqwind)
|
||||
|
||||
<br>
|
||||
|
||||
## Roadmap
|
||||
|
||||
### Base
|
||||
- [ ] Create utilities to generate permalinks tailored to the domain and base pathname.
|
||||
- [ ] Simplify the way to optimize images.
|
||||
- [ ] Create component to make SEO simpler and more intuitive.
|
||||
- [ ] Create configurable blog with categories, tags and authors using MDX.
|
||||
- [ ] Add more frequently used pages (Portfolio, Services, Contact, Docs ...).
|
||||
- [ ] Find or create a library to have more icon sources available.
|
||||
- [ ] Refactor some code that doesn't follow Qwik conventions yet.
|
||||
|
||||
### Advanced
|
||||
|
||||
- [ ] Achieve perfect 100% Google Page Speed score.
|
||||
- [ ] Insert complex javascript example widget on home page to demonstrate Qwik features.
|
||||
- [ ] Create small illustrative admin backend.
|
||||
|
||||
<br>
|
||||
|
||||
## Contributing
|
||||
|
||||
If you have any idea, suggestions or find any bugs, feel free to open a discussion, an issue or create a pull request.
|
||||
That would be very useful for all of us and we would be happy to listen and take action.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
Initially created by [onWidget](https://onwidget.com) and maintained by a community of [contributors](https://github.com/onwidget/qwind/graphs/contributors).
|
||||
|
||||
## License
|
||||
|
||||
**Qwind** is licensed under the MIT license — see the [LICENSE](https://github.com/onwidget/qwind/blob/main/LICENSE.md) file for details.
|
||||
|
||||
## Cloudflare Pages
|
||||
|
||||
Cloudflare's [wrangler](https://github.com/cloudflare/wrangler) CLI can be used to preview a production build locally. To start a local server, run:
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
Then visit [http://localhost:8787/](http://localhost:8787/)
|
||||
|
||||
### Deployments
|
||||
|
||||
[Cloudflare Pages](https://pages.cloudflare.com/) are deployable through their [Git provider integrations](https://developers.cloudflare.com/pages/platform/git-integration/).
|
||||
|
||||
If you don't already have an account, then [create a Cloudflare account here](https://dash.cloudflare.com/sign-up/pages). Next go to your dashboard and follow the [Cloudflare Pages deployment guide](https://developers.cloudflare.com/pages/framework-guides/deploy-anything/).
|
||||
|
||||
Within the projects "Settings" for "Build and deployments", the "Build command" should be `npm run build`, and the "Build output directory" should be set to `dist`.
|
||||
|
||||
### Function Invocation Routes
|
||||
|
||||
Cloudflare Page's [function-invocation-routes config](https://developers.cloudflare.com/pages/platform/functions/function-invocation-routes/) can be used to include, or exclude, certain paths to be used by the worker functions. Having a `_routes.json` file gives developers more granular control over when your Function is invoked.
|
||||
This is useful to determine if a page response should be Server-Side Rendered (SSR) or if the response should use a static-site generated (SSG) `index.html` file.
|
||||
|
||||
By default, the Cloudflare pages adaptor _does not_ include a `public/_routes.json` config, but rather it is auto-generated from the build by the Cloudflare adaptor. An example of an auto-generate `dist/_routes.json` would be:
|
||||
|
||||
```
|
||||
{
|
||||
"include": [
|
||||
"/*"
|
||||
],
|
||||
"exclude": [
|
||||
"/_headers",
|
||||
"/_redirects",
|
||||
"/build/*",
|
||||
"/favicon.ico",
|
||||
"/manifest.json",
|
||||
"/service-worker.js",
|
||||
"/about"
|
||||
],
|
||||
"version": 1
|
||||
}
|
||||
```
|
||||
|
||||
In the above example, it's saying _all_ pages should be SSR'd. However, the root static files such as `/favicon.ico` and any static assets in `/build/*` should be excluded from the Functions, and instead treated as a static file.
|
||||
|
||||
In most cases the generated `dist/_routes.json` file is ideal. However, if you need more granular control over each path, you can instead provide you're own `public/_routes.json` file. When the project provides its own `public/_routes.json` file, then the Cloudflare adaptor will not auto-generate the routes config and instead use the committed one within the `public` directory.
|
||||
|
||||
## Cloudflare Pages
|
||||
|
||||
Cloudflare's [wrangler](https://github.com/cloudflare/wrangler) CLI can be used to preview a production build locally. To start a local server, run:
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
Then visit [http://localhost:8787/](http://localhost:8787/)
|
||||
|
||||
### Deployments
|
||||
|
||||
[Cloudflare Pages](https://pages.cloudflare.com/) are deployable through their [Git provider integrations](https://developers.cloudflare.com/pages/platform/git-integration/).
|
||||
|
||||
If you don't already have an account, then [create a Cloudflare account here](https://dash.cloudflare.com/sign-up/pages). Next go to your dashboard and follow the [Cloudflare Pages deployment guide](https://developers.cloudflare.com/pages/framework-guides/deploy-anything/).
|
||||
|
||||
Within the projects "Settings" for "Build and deployments", the "Build command" should be `npm run build`, and the "Build output directory" should be set to `dist`.
|
||||
|
||||
### Function Invocation Routes
|
||||
|
||||
Cloudflare Page's [function-invocation-routes config](https://developers.cloudflare.com/pages/platform/functions/function-invocation-routes/) can be used to include, or exclude, certain paths to be used by the worker functions. Having a `_routes.json` file gives developers more granular control over when your Function is invoked.
|
||||
This is useful to determine if a page response should be Server-Side Rendered (SSR) or if the response should use a static-site generated (SSG) `index.html` file.
|
||||
|
||||
By default, the Cloudflare pages adaptor _does not_ include a `public/_routes.json` config, but rather it is auto-generated from the build by the Cloudflare adaptor. An example of an auto-generate `dist/_routes.json` would be:
|
||||
|
||||
```
|
||||
{
|
||||
"include": [
|
||||
"/*"
|
||||
],
|
||||
"exclude": [
|
||||
"/_headers",
|
||||
"/_redirects",
|
||||
"/build/*",
|
||||
"/favicon.ico",
|
||||
"/manifest.json",
|
||||
"/service-worker.js",
|
||||
"/about"
|
||||
],
|
||||
"version": 1
|
||||
}
|
||||
```
|
||||
|
||||
In the above example, it's saying _all_ pages should be SSR'd. However, the root static files such as `/favicon.ico` and any static assets in `/build/*` should be excluded from the Functions, and instead treated as a static file.
|
||||
|
||||
In most cases the generated `dist/_routes.json` file is ideal. However, if you need more granular control over each path, you can instead provide you're own `public/_routes.json` file. When the project provides its own `public/_routes.json` file, then the Cloudflare adaptor will not auto-generate the routes config and instead use the committed one within the `public` directory.
|
||||
|
||||
## Express Server
|
||||
|
||||
This app has a minimal [Express server](https://expressjs.com/) implementation. After running a full build, you can preview the build using the command:
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
Then visit [http://localhost:8080/](http://localhost:8080/)
|
||||
|
||||
## Netlify
|
||||
|
||||
This starter site is configured to deploy to [Netlify Edge Functions](https://docs.netlify.com/edge-functions/overview/), which means it will be rendered at an edge location near to your users.
|
||||
|
||||
### Local development
|
||||
|
||||
The [Netlify CLI](https://docs.netlify.com/cli/get-started/) can be used to preview a production build locally. To do so: First build your site, then to start a local server, run:
|
||||
|
||||
1. Install Netlify CLI globally `npm i -g netlify-cli`.
|
||||
2. Build your site with both ssr and static `npm run build`.
|
||||
3. Start a local server with `npm run serve`.
|
||||
In this project, `npm run serve` uses the `netlify dev` command to spin up a server that can handle Netlify's Edge Functions locally.
|
||||
4. Visit [http://localhost:8888/](http://localhost:8888/) to check out your site.
|
||||
|
||||
### Edge Functions Declarations
|
||||
|
||||
[Netlify Edge Functions declarations](https://docs.netlify.com/edge-functions/declarations/)
|
||||
can be configured to run on specific URL patterns. Each edge function declaration associates
|
||||
one site path pattern with one function to execute on requests that match the path. A single request can execute a chain of edge functions from a series of declarations. A single edge function can be associated with multiple paths across various declarations.
|
||||
|
||||
This is useful to determine if a page response should be Server-Side Rendered (SSR) or
|
||||
if the response should use a static-site generated (SSG) `index.html` file instead.
|
||||
|
||||
By default, the Netlify Edge adaptor will generate a `.netlify/edge-middleware/manifest.json` file, which is used by the Netlify deployment to determine which paths should, and should not, use edge functions.
|
||||
|
||||
To override the generated manifest, you can [add a declaration](https://docs.netlify.com/edge-functions/declarations/#add-a-declaration) to the `netlify.toml` using the `[[edge_functions]]` config. For example:
|
||||
|
||||
```toml
|
||||
[[edge_functions]]
|
||||
path = "/admin"
|
||||
function = "auth"
|
||||
```
|
||||
|
||||
### Deployments
|
||||
|
||||
You can [deploy your site to Netlify](https://docs.netlify.com/site-deploys/create-deploys/) either via a Git provider integration or through the Netlify CLI. This starter site includes a `netlify.toml` file to configure your build for deployment.
|
||||
|
||||
#### Deploying via Git
|
||||
|
||||
Once your site has been pushed to your Git provider, you can either link it [in the Netlify UI](https://app.netlify.com/start) or use the CLI. To link your site to a Git provider from the Netlify CLI, run the command:
|
||||
|
||||
```shell
|
||||
netlify link
|
||||
```
|
||||
|
||||
This sets up [continuous deployment](https://docs.netlify.com/site-deploys/create-deploys/#deploy-with-git) for your site's repo. Whenever you push new commits to your repo, Netlify starts the build process..
|
||||
|
||||
#### Deploying manually via the CLI
|
||||
|
||||
If you wish to deploy from the CLI rather than using Git, you can use the command:
|
||||
|
||||
```shell
|
||||
netlify deploy --build
|
||||
```
|
||||
|
||||
You must use the `--build` flag whenever you deploy. This ensures that the Edge Functions that this starter site relies on are generated and available when you deploy your site.
|
||||
|
||||
Add `--prod` flag to deploy to production.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite'
|
||||
import { netifyEdgeAdaptor } from '@builder.io/qwik-city/adaptors/netlify-edge/vite'
|
||||
import { extendConfig } from '@builder.io/qwik-city/vite'
|
||||
import baseConfig from '../../vite.config'
|
||||
|
||||
@@ -7,11 +7,12 @@ export default extendConfig(baseConfig, () => {
|
||||
build: {
|
||||
ssr: true,
|
||||
rollupOptions: {
|
||||
input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
|
||||
input: ['src/entry.netlify-edge.tsx', '@qwik-city-plan'],
|
||||
},
|
||||
outDir: '.netlify/edge-functions/entry.netlify-edge',
|
||||
},
|
||||
plugins: [
|
||||
cloudflarePagesAdaptor({
|
||||
netifyEdgeAdaptor({
|
||||
staticGenerate: true,
|
||||
}),
|
||||
],
|
||||
21
packages/docs/adaptors/static/vite.config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { staticAdaptor } from '@builder.io/qwik-city/adaptors/static/vite'
|
||||
import { extendConfig } from '@builder.io/qwik-city/vite'
|
||||
import baseConfig from '../../vite.config'
|
||||
|
||||
import { SITE } from '../../src/config.mjs'
|
||||
|
||||
export default extendConfig(baseConfig, () => {
|
||||
return {
|
||||
build: {
|
||||
ssr: true,
|
||||
rollupOptions: {
|
||||
input: ['@qwik-city-plan'],
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
staticAdaptor({
|
||||
origin: SITE.origin,
|
||||
}),
|
||||
],
|
||||
}
|
||||
})
|
||||
7
packages/docs/netlify.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[build]
|
||||
publish = "dist"
|
||||
command = "npm run build"
|
||||
|
||||
[[edge_functions]]
|
||||
path = "/*"
|
||||
function = "entry.netlify-edge"
|
||||
@@ -1,44 +1,56 @@
|
||||
{
|
||||
"name": "bot-whatsapp-docs",
|
||||
"version": "0.0.1",
|
||||
"description": "Basic start point to build a docs site with Qwik",
|
||||
"engines": {
|
||||
"node": ">=15.0.0"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "qwik build",
|
||||
"build.client": "vite build",
|
||||
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
||||
"build.server": "vite build -c adaptors/cloudflare-pages/vite.config.ts",
|
||||
"build.types": "tsc --incremental --noEmit",
|
||||
"deploy": "wrangler pages dev ./dist",
|
||||
"dev": "vite --mode ssr",
|
||||
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
||||
"fmt": "prettier --write .",
|
||||
"fmt.check": "prettier --check .",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"preview": "qwik build preview && vite preview --open",
|
||||
"start": "vite --open --mode ssr",
|
||||
"qwik": "qwik"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@builder.io/qwik": "0.14.1",
|
||||
"@builder.io/qwik-city": "0.0.127",
|
||||
"@types/eslint": "8.4.10",
|
||||
"@types/node": "latest",
|
||||
"@typescript-eslint/eslint-plugin": "5.43.0",
|
||||
"@typescript-eslint/parser": "5.43.0",
|
||||
"autoprefixer": "10.4.11",
|
||||
"eslint": "8.28.0",
|
||||
"eslint-plugin-qwik": "0.14.1",
|
||||
"node-fetch": "3.3.0",
|
||||
"postcss": "^8.4.16",
|
||||
"prettier": "2.7.1",
|
||||
"tailwindcss": "^3.1.8",
|
||||
"typescript": "4.9.3",
|
||||
"vite": "3.2.4",
|
||||
"vite-tsconfig-paths": "3.5.0",
|
||||
"wrangler": "latest"
|
||||
}
|
||||
"name": "qwind",
|
||||
"description": "A template to make your website using Qwik + Tailwind CSS.",
|
||||
"version": "0.1.1",
|
||||
"scripts": {
|
||||
"build": "qwik build && npm run subfont",
|
||||
"build.client": "vite build",
|
||||
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
||||
"build.server": "vite build -c adaptors/netlify-edge/vite.config.ts",
|
||||
"build.types": "tsc --incremental --noEmit",
|
||||
"deploy": "netlify deploy --prod",
|
||||
"dev": "vite --host --mode ssr",
|
||||
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
||||
"fmt": "prettier --write .",
|
||||
"fmt.check": "prettier --check .",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"preview": "qwik build preview && vite preview --open",
|
||||
"start": "vite --open --mode ssr",
|
||||
"subfont": "subfont -i --inline-css --no-fallbacks --silent --root dist",
|
||||
"qwik": "qwik"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@builder.io/qwik": "0.16.1",
|
||||
"@builder.io/qwik-city": "0.0.128",
|
||||
"@fontsource/inter": "^4.5.14",
|
||||
"@iconify-json/tabler": "^1.1.49",
|
||||
"@tailwindcss/aspect-ratio": "^0.4.0",
|
||||
"@tailwindcss/forms": "^0.5.3",
|
||||
"@tailwindcss/line-clamp": "^0.3.1",
|
||||
"@tailwindcss/typography": "^0.5.0",
|
||||
"@types/compression": "^1.7.2",
|
||||
"@types/eslint": "8.4.10",
|
||||
"@types/node": "latest",
|
||||
"@typescript-eslint/eslint-plugin": "5.45.0",
|
||||
"@typescript-eslint/parser": "5.45.0",
|
||||
"autoprefixer": "10.4.13",
|
||||
"compression": "^1.7.4",
|
||||
"eslint": "8.29.0",
|
||||
"eslint-plugin-qwik": "0.15.0",
|
||||
"imagetools-core": "^3.2.3",
|
||||
"netlify-cli": "^12.0.11",
|
||||
"node-fetch": "^3.3.0",
|
||||
"postcss": "^8.4.19",
|
||||
"prettier": "2.8.0",
|
||||
"rehype-autolink-headings": "^6.1.1",
|
||||
"subfont": "^6.12.2",
|
||||
"tailwindcss": "^3.1.8",
|
||||
"typescript": "4.8.4",
|
||||
"vite": "3.2.4",
|
||||
"vite-imagetools": "^4.0.11",
|
||||
"vite-tsconfig-paths": "3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=17.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
# https://developers.cloudflare.com/pages/platform/headers/
|
||||
|
||||
/build/*
|
||||
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
|
||||
|
||||
BIN
packages/docs/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 500 500"><g clip-path="url(#a)"><circle cx="250" cy="250" r="250" fill="#fff"/><path fill="#18B6F6" d="m367.87 418.45-61.17-61.18-.94.13v-.67L175.7 227.53l32.05-31.13L188.9 87.73 99.56 199.09c-15.22 15.42-18.03 40.51-7.08 59.03l55.83 93.11a46.82 46.82 0 0 0 40.73 22.81l27.65-.27 151.18 44.68Z"/><path fill="#AC7EF4" d="m401.25 196.94-12.29-22.81-6.41-11.67-2.54-4.56-.26.26-33.66-58.63a47.07 47.07 0 0 0-41.27-23.75l-29.51.8-88.01.28a47.07 47.07 0 0 0-40.33 23.34L93.4 207l95.76-119.54L314.7 226.19l-22.3 22.67 13.35 108.54.13-.26v.26h-.26l.26.27 10.42 10.2 50.62 49.78c2.13 2 5.6-.4 4.13-2.96l-31.25-61.85 54.5-101.3 1.73-2c.67-.81 1.33-1.62 1.87-2.42a46.8 46.8 0 0 0 3.34-50.18Z"/><path fill="#fff" d="M315.1 225.65 189.18 87.6l17.9 108.14L175 227l130.5 130.27-11.75-108.14 21.37-23.48Z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h500v500H0z"/></clipPath></defs></svg>
|
||||
|
Before Width: | Height: | Size: 947 B |
11
packages/docs/sandbox.config.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"infiniteLoopProtection": true,
|
||||
"hardReloadOnChange": false,
|
||||
"view": "browser",
|
||||
"template": "node",
|
||||
"container": {
|
||||
"port": 5173,
|
||||
"startScript": "start",
|
||||
"node": "16"
|
||||
}
|
||||
}
|
||||
BIN
packages/docs/screenshot.jpg
Normal file
|
After Width: | Height: | Size: 424 KiB |
BIN
packages/docs/src/assets/fonts/FiraCode-VF.woff
Normal file
BIN
packages/docs/src/assets/fonts/FiraCode-VF.woff2
Normal file
BIN
packages/docs/src/assets/fonts/IBMPlexMono-Regular.ttf
Normal file
BIN
packages/docs/src/assets/fonts/IBMPlexMono-SemiBold.ttf
Normal file
BIN
packages/docs/src/assets/fonts/Inter-italic-latin.var.woff2
Normal file
BIN
packages/docs/src/assets/fonts/Inter-roman-latin.var.woff2
Normal file
BIN
packages/docs/src/assets/fonts/Pally-Variable.ttf
Normal file
BIN
packages/docs/src/assets/fonts/SourceSansPro-Regular.otf
Normal file
BIN
packages/docs/src/assets/fonts/SourceSerifPro-Regular.ttf
Normal file
BIN
packages/docs/src/assets/fonts/Synonym-Variable.ttf
Normal file
BIN
packages/docs/src/assets/fonts/Ubuntu-Mono-bold.woff2
Normal file
@@ -0,0 +1,13 @@
|
||||
.font {
|
||||
font-family: IBMPlexMono-Regular;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: IBMPlexMono-Regular;
|
||||
src: url(IBMPlexMono-Regular-subset.woff2) format('woff2'),
|
||||
url(IBMPlexMono-Regular-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+2C, U+2E, U+41-43, U+46, U+49, U+4B-4F, U+53-55, U+58,
|
||||
U+61-65, U+67-69, U+6C-76;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.font {
|
||||
font-family: IBMPlexMono-SemiBold;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: IBMPlexMono-SemiBold;
|
||||
src: url(IBMPlexMono-SemiBold-subset.woff2) format('woff2'),
|
||||
url(IBMPlexMono-SemiBold-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+24, U+2E, U+30, U+38, U+39, U+41, U+42, U+44, U+47,
|
||||
U+4E, U+4F, U+52-55, U+57, U+59, U+65, U+68, U+6F, U+72, U+74;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
.font {
|
||||
font-family: Pally-Variable;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: Pally-Variable;
|
||||
src: url(Pally-Variable-subset.woff2) format('woff2'),
|
||||
url(Pally-Variable-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+24, U+2C, U+2E, U+30, U+33, U+39, U+41-43, U+46,
|
||||
U+49-4D, U+53, U+55, U+58, U+61-65, U+67-69, U+6B-77, U+79;
|
||||
font-weight: 400 700;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.font {
|
||||
font-family: SourceSerifPro-Regular;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: SourceSerifPro-Regular;
|
||||
src: url(SourceSerifPro-Regular-subset.woff2) format('woff2'),
|
||||
url(SourceSerifPro-Regular-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+2C, U+2E, U+41-44, U+49, U+4A, U+4C, U+53, U+55,
|
||||
U+61-65, U+67-69, U+6B-76, U+79;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
.font {
|
||||
font-family: Synonym-Variable;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: Synonym-Variable;
|
||||
src: url(Synonym-Variable-subset.woff2) format('woff2'),
|
||||
url(Synonym-Variable-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+24, U+2C, U+2E, U+30, U+33, U+35, U+41-44, U+46, U+47,
|
||||
U+49, U+4B-4F, U+53-55, U+57-59, U+61, U+63-65, U+67-69, U+6C-76;
|
||||
font-weight: 400 700;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.font {
|
||||
font-family: TenorSans-Regular;
|
||||
}
|
||||
|
||||
/* This file was automatically generated by GlyphHanger 4.0.1 */
|
||||
|
||||
@font-face {
|
||||
font-family: TenorSans-Regular;
|
||||
src: url(TenorSans-Regular-subset.woff2) format('woff2'),
|
||||
url(TenorSans-Regular-subset.zopfli.woff) format('woff');
|
||||
unicode-range: U+20, U+24, U+2E, U+30, U+36, U+46, U+49, U+4A, U+53, U+54,
|
||||
U+61, U+63, U+65, U+69, U+6B, U+6E, U+6F, U+72-75, U+79;
|
||||
}
|
||||
BIN
packages/docs/src/assets/images/chatbot-whatsapp.png
Normal file
|
After Width: | Height: | Size: 401 KiB |
BIN
packages/docs/src/assets/images/desahogo.png
Normal file
|
After Width: | Height: | Size: 670 KiB |
BIN
packages/docs/src/assets/images/eyes.png
Normal file
|
After Width: | Height: | Size: 423 KiB |
BIN
packages/docs/src/assets/images/full-logo-light.png
Normal file
|
After Width: | Height: | Size: 173 KiB |