@builderbot/cli 1.0.19-alpha.0 → 1.0.20-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/starters/apps/base-js-baileys-json/src/app.js +10 -5
  2. package/dist/starters/apps/base-js-baileys-memory/src/app.js +10 -5
  3. package/dist/starters/apps/base-js-baileys-mongo/src/app.js +10 -5
  4. package/dist/starters/apps/base-js-baileys-mysql/src/app.js +10 -5
  5. package/dist/starters/apps/base-js-baileys-postgres/src/app.js +10 -5
  6. package/dist/starters/apps/base-js-meta-json/src/app.js +10 -5
  7. package/dist/starters/apps/base-js-meta-memory/src/app.js +10 -5
  8. package/dist/starters/apps/base-js-meta-mongo/src/app.js +10 -5
  9. package/dist/starters/apps/base-js-meta-mysql/src/app.js +10 -5
  10. package/dist/starters/apps/base-js-meta-postgres/src/app.js +10 -5
  11. package/dist/starters/apps/base-js-twilio-json/src/app.js +10 -5
  12. package/dist/starters/apps/base-js-twilio-memory/src/app.js +10 -5
  13. package/dist/starters/apps/base-js-twilio-mongo/src/app.js +10 -5
  14. package/dist/starters/apps/base-js-twilio-mysql/src/app.js +10 -5
  15. package/dist/starters/apps/base-js-twilio-postgres/src/app.js +10 -5
  16. package/dist/starters/apps/base-js-venom-json/src/app.js +10 -5
  17. package/dist/starters/apps/base-js-venom-memory/src/app.js +10 -5
  18. package/dist/starters/apps/base-js-venom-mongo/src/app.js +10 -5
  19. package/dist/starters/apps/base-js-venom-mysql/src/app.js +10 -5
  20. package/dist/starters/apps/base-js-venom-postgres/src/app.js +10 -5
  21. package/dist/starters/apps/base-js-wppconnect-json/src/app.js +10 -5
  22. package/dist/starters/apps/base-js-wppconnect-memory/src/app.js +10 -5
  23. package/dist/starters/apps/base-js-wppconnect-mongo/src/app.js +10 -5
  24. package/dist/starters/apps/base-js-wppconnect-mysql/src/app.js +10 -5
  25. package/dist/starters/apps/base-js-wppconnect-postgres/src/app.js +10 -5
  26. package/dist/starters/apps/base-ts-baileys-json/src/app.ts +10 -5
  27. package/dist/starters/apps/base-ts-baileys-memory/src/app.ts +10 -5
  28. package/dist/starters/apps/base-ts-baileys-mongo/src/app.ts +10 -5
  29. package/dist/starters/apps/base-ts-baileys-mysql/src/app.ts +10 -5
  30. package/dist/starters/apps/base-ts-baileys-postgres/src/app.ts +10 -5
  31. package/dist/starters/apps/base-ts-meta-json/src/app.ts +10 -5
  32. package/dist/starters/apps/base-ts-meta-memory/src/app.ts +10 -5
  33. package/dist/starters/apps/base-ts-meta-mongo/src/app.ts +10 -5
  34. package/dist/starters/apps/base-ts-meta-mysql/src/app.ts +10 -5
  35. package/dist/starters/apps/base-ts-meta-postgres/src/app.ts +10 -5
  36. package/dist/starters/apps/base-ts-twilio-json/src/app.ts +10 -5
  37. package/dist/starters/apps/base-ts-twilio-memory/src/app.ts +10 -5
  38. package/dist/starters/apps/base-ts-twilio-mongo/src/app.ts +10 -5
  39. package/dist/starters/apps/base-ts-twilio-mysql/src/app.ts +10 -5
  40. package/dist/starters/apps/base-ts-twilio-postgres/src/app.ts +10 -5
  41. package/dist/starters/apps/base-ts-venom-json/src/app.ts +10 -5
  42. package/dist/starters/apps/base-ts-venom-memory/src/app.ts +10 -5
  43. package/dist/starters/apps/base-ts-venom-mongo/src/app.ts +10 -5
  44. package/dist/starters/apps/base-ts-venom-mysql/src/app.ts +10 -5
  45. package/dist/starters/apps/base-ts-venom-postgres/src/app.ts +10 -5
  46. package/dist/starters/apps/base-ts-wppconnect-json/src/app.ts +10 -5
  47. package/dist/starters/apps/base-ts-wppconnect-memory/src/app.ts +10 -5
  48. package/dist/starters/apps/base-ts-wppconnect-mongo/src/app.ts +10 -5
  49. package/dist/starters/apps/base-ts-wppconnect-mysql/src/app.ts +10 -5
  50. package/dist/starters/apps/base-ts-wppconnect-postgres/src/app.ts +10 -5
  51. package/package.json +2 -2
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -83,8 +88,8 @@ const main = async () => {
83
88
  '/v1/blacklist',
84
89
  handleCtx(async (bot, req, res) => {
85
90
  const { number, intent } = req.body
86
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
87
- if (intent === 'add') bot.blacklist.add(`340000000`)
91
+ if (intent === 'remove') bot.blacklist.remove(number)
92
+ if (intent === 'add') bot.blacklist.add(number)
88
93
 
89
94
  res.writeHead(200, { 'Content-Type': 'application/json' })
90
95
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -78,8 +83,8 @@ const main = async () => {
78
83
  '/v1/blacklist',
79
84
  handleCtx(async (bot, req, res) => {
80
85
  const { number, intent } = req.body
81
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
82
- if (intent === 'add') bot.blacklist.add(`340000000`)
86
+ if (intent === 'remove') bot.blacklist.remove(number)
87
+ if (intent === 'add') bot.blacklist.add(number)
83
88
 
84
89
  res.writeHead(200, { 'Content-Type': 'application/json' })
85
90
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -77,8 +82,8 @@ const main = async () => {
77
82
  '/v1/blacklist',
78
83
  handleCtx(async (bot, req, res) => {
79
84
  const { number, intent } = req.body
80
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
81
- if (intent === 'add') bot.blacklist.add(`340000000`)
85
+ if (intent === 'remove') bot.blacklist.remove(number)
86
+ if (intent === 'add') bot.blacklist.add(number)
82
87
 
83
88
  res.writeHead(200, { 'Content-Type': 'application/json' })
84
89
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -80,8 +85,8 @@ const main = async () => {
80
85
  '/v1/blacklist',
81
86
  handleCtx(async (bot, req, res) => {
82
87
  const { number, intent } = req.body
83
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
84
- if (intent === 'add') bot.blacklist.add(`340000000`)
88
+ if (intent === 'remove') bot.blacklist.remove(number)
89
+ if (intent === 'add') bot.blacklist.add(number)
85
90
 
86
91
  res.writeHead(200, { 'Content-Type': 'application/json' })
87
92
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -82,8 +87,8 @@ const main = async () => {
82
87
  '/v1/blacklist',
83
88
  handleCtx(async (bot, req, res) => {
84
89
  const { number, intent } = req.body
85
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
86
- if (intent === 'add') bot.blacklist.add(`340000000`)
90
+ if (intent === 'remove') bot.blacklist.remove(number)
91
+ if (intent === 'add') bot.blacklist.add(number)
87
92
 
88
93
  res.writeHead(200, { 'Content-Type': 'application/json' })
89
94
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -83,8 +88,8 @@ const main = async () => {
83
88
  '/v1/blacklist',
84
89
  handleCtx(async (bot, req, res) => {
85
90
  const { number, intent } = req.body
86
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
87
- if (intent === 'add') bot.blacklist.add(`340000000`)
91
+ if (intent === 'remove') bot.blacklist.remove(number)
92
+ if (intent === 'add') bot.blacklist.add(number)
88
93
 
89
94
  res.writeHead(200, { 'Content-Type': 'application/json' })
90
95
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -78,8 +83,8 @@ const main = async () => {
78
83
  '/v1/blacklist',
79
84
  handleCtx(async (bot, req, res) => {
80
85
  const { number, intent } = req.body
81
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
82
- if (intent === 'add') bot.blacklist.add(`340000000`)
86
+ if (intent === 'remove') bot.blacklist.remove(number)
87
+ if (intent === 'add') bot.blacklist.add(number)
83
88
 
84
89
  res.writeHead(200, { 'Content-Type': 'application/json' })
85
90
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -77,8 +82,8 @@ const main = async () => {
77
82
  '/v1/blacklist',
78
83
  handleCtx(async (bot, req, res) => {
79
84
  const { number, intent } = req.body
80
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
81
- if (intent === 'add') bot.blacklist.add(`340000000`)
85
+ if (intent === 'remove') bot.blacklist.remove(number)
86
+ if (intent === 'add') bot.blacklist.add(number)
82
87
 
83
88
  res.writeHead(200, { 'Content-Type': 'application/json' })
84
89
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -80,8 +85,8 @@ const main = async () => {
80
85
  '/v1/blacklist',
81
86
  handleCtx(async (bot, req, res) => {
82
87
  const { number, intent } = req.body
83
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
84
- if (intent === 'add') bot.blacklist.add(`340000000`)
88
+ if (intent === 'remove') bot.blacklist.remove(number)
89
+ if (intent === 'add') bot.blacklist.add(number)
85
90
 
86
91
  res.writeHead(200, { 'Content-Type': 'application/json' })
87
92
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -82,8 +87,8 @@ const main = async () => {
82
87
  '/v1/blacklist',
83
88
  handleCtx(async (bot, req, res) => {
84
89
  const { number, intent } = req.body
85
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
86
- if (intent === 'add') bot.blacklist.add(`340000000`)
90
+ if (intent === 'remove') bot.blacklist.remove(number)
91
+ if (intent === 'add') bot.blacklist.add(number)
87
92
 
88
93
  res.writeHead(200, { 'Content-Type': 'application/json' })
89
94
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -83,8 +88,8 @@ const main = async () => {
83
88
  '/v1/blacklist',
84
89
  handleCtx(async (bot, req, res) => {
85
90
  const { number, intent } = req.body
86
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
87
- if (intent === 'add') bot.blacklist.add(`340000000`)
91
+ if (intent === 'remove') bot.blacklist.remove(number)
92
+ if (intent === 'add') bot.blacklist.add(number)
88
93
 
89
94
  res.writeHead(200, { 'Content-Type': 'application/json' })
90
95
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -82,8 +87,8 @@ const main = async () => {
82
87
  '/v1/blacklist',
83
88
  handleCtx(async (bot, req, res) => {
84
89
  const { number, intent } = req.body
85
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
86
- if (intent === 'add') bot.blacklist.add(`340000000`)
90
+ if (intent === 'remove') bot.blacklist.remove(number)
91
+ if (intent === 'add') bot.blacklist.add(number)
87
92
 
88
93
  res.writeHead(200, { 'Content-Type': 'application/json' })
89
94
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -81,8 +86,8 @@ const main = async () => {
81
86
  '/v1/blacklist',
82
87
  handleCtx(async (bot, req, res) => {
83
88
  const { number, intent } = req.body
84
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
85
- if (intent === 'add') bot.blacklist.add(`340000000`)
89
+ if (intent === 'remove') bot.blacklist.remove(number)
90
+ if (intent === 'add') bot.blacklist.add(number)
86
91
 
87
92
  res.writeHead(200, { 'Content-Type': 'application/json' })
88
93
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -84,8 +89,8 @@ const main = async () => {
84
89
  '/v1/blacklist',
85
90
  handleCtx(async (bot, req, res) => {
86
91
  const { number, intent } = req.body
87
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
88
- if (intent === 'add') bot.blacklist.add(`340000000`)
92
+ if (intent === 'remove') bot.blacklist.remove(number)
93
+ if (intent === 'add') bot.blacklist.add(number)
89
94
 
90
95
  res.writeHead(200, { 'Content-Type': 'application/json' })
91
96
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -86,8 +91,8 @@ const main = async () => {
86
91
  '/v1/blacklist',
87
92
  handleCtx(async (bot, req, res) => {
88
93
  const { number, intent } = req.body
89
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
90
- if (intent === 'add') bot.blacklist.add(`340000000`)
94
+ if (intent === 'remove') bot.blacklist.remove(number)
95
+ if (intent === 'add') bot.blacklist.add(number)
91
96
 
92
97
  res.writeHead(200, { 'Content-Type': 'application/json' })
93
98
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -87,8 +92,8 @@ const main = async () => {
87
92
  '/v1/blacklist',
88
93
  handleCtx(async (bot, req, res) => {
89
94
  const { number, intent } = req.body
90
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
91
- if (intent === 'add') bot.blacklist.add(`340000000`)
95
+ if (intent === 'remove') bot.blacklist.remove(number)
96
+ if (intent === 'add') bot.blacklist.add(number)
92
97
 
93
98
  res.writeHead(200, { 'Content-Type': 'application/json' })
94
99
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -81,8 +86,8 @@ const main = async () => {
81
86
  '/v1/blacklist',
82
87
  handleCtx(async (bot, req, res) => {
83
88
  const { number, intent } = req.body
84
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
85
- if (intent === 'add') bot.blacklist.add(`340000000`)
89
+ if (intent === 'remove') bot.blacklist.remove(number)
90
+ if (intent === 'add') bot.blacklist.add(number)
86
91
 
87
92
  res.writeHead(200, { 'Content-Type': 'application/json' })
88
93
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -80,8 +85,8 @@ const main = async () => {
80
85
  '/v1/blacklist',
81
86
  handleCtx(async (bot, req, res) => {
82
87
  const { number, intent } = req.body
83
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
84
- if (intent === 'add') bot.blacklist.add(`340000000`)
88
+ if (intent === 'remove') bot.blacklist.remove(number)
89
+ if (intent === 'add') bot.blacklist.add(number)
85
90
 
86
91
  res.writeHead(200, { 'Content-Type': 'application/json' })
87
92
  return res.end(JSON.stringify({ status: 'ok', number, intent }))
@@ -25,12 +25,17 @@ const welcomeFlow = addKeyword<Provider, Database>(['hi', 'hello', 'hola'])
25
25
  'I share with you the following links of interest about the project',
26
26
  '👉 *doc* to view the documentation',
27
27
  ].join('\n'),
28
- { delay: 800 },
29
- null,
28
+ { delay: 800, capture: true },
29
+ async (ctx, { fallBack }) => {
30
+ if (!ctx.body.toLocaleLowerCase().includes('doc')) {
31
+ return fallBack('You should type *doc*')
32
+ }
33
+ return
34
+ },
30
35
  [discordFlow]
31
36
  )
32
37
 
33
- const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_FLOW'))
38
+ const registerFlow = addKeyword<Provider, Database>(utils.setEvent('REGISTER_EVENT'))
34
39
  .addAnswer(`What is your name?`, { capture: true }, async (ctx, { state }) => {
35
40
  await state.update({ name: ctx.body })
36
41
  })
@@ -83,8 +88,8 @@ const main = async () => {
83
88
  '/v1/blacklist',
84
89
  handleCtx(async (bot, req, res) => {
85
90
  const { number, intent } = req.body
86
- if (intent === 'remove') bot.blacklist.remove(`340000000`)
87
- if (intent === 'add') bot.blacklist.add(`340000000`)
91
+ if (intent === 'remove') bot.blacklist.remove(number)
92
+ if (intent === 'add') bot.blacklist.add(number)
88
93
 
89
94
  res.writeHead(200, { 'Content-Type': 'application/json' })
90
95
  return res.end(JSON.stringify({ status: 'ok', number, intent }))