forked from codigoencasa/builderbot
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): new provider - venon:zap: configuracion inicial provi…
…der venom
- Loading branch information
1 parent
091544a
commit fee7c2e
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { ProviderClass } = require('@bot-whatsapp/bot') | ||
const venom = require('venom-bot') | ||
const { cleanNumber } = require('../web-whatsapp/utils') | ||
|
||
class VenomProvider extends ProviderClass { | ||
constructor() { | ||
super() | ||
this.client | ||
venom | ||
.create({ | ||
session: 'session-1', //nombre de la sesion o id | ||
multidevice: true, // Para el funcinamiento de multiusuarios.(default: true) | ||
}) | ||
.then((client) => (this.client = client)) | ||
.catch((erro) => { | ||
console.log(erro) | ||
}) | ||
} | ||
|
||
sendMessage = async (number, message) => { | ||
const numero = cleanNumber(number) | ||
return this.client.sendText(numero, message) | ||
} | ||
} | ||
|