mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 03:59:17 +00:00
.
This commit is contained in:
20
packages/io/classes/flow.class.js
Normal file
20
packages/io/classes/flow.class.js
Normal file
@@ -0,0 +1,20 @@
|
||||
class FlowClass {
|
||||
flow
|
||||
constructor(_flow) {
|
||||
this.flow = _flow
|
||||
}
|
||||
|
||||
find = (message, ref = false) => {
|
||||
let keyRef = ref
|
||||
let ansRef = null
|
||||
if (!keyRef) {
|
||||
keyRef =
|
||||
this.flow.find((n) => n.keyword.includes(message))?.ref || null
|
||||
}
|
||||
ansRef = this.flow.find((n) => n.keyword === keyRef)
|
||||
if (ansRef) return ansRef
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = FlowClass
|
||||
Reference in New Issue
Block a user