Skip to content

Commit

Permalink
feat(provider): new provider - venon:zap: configuracion inicial provi…
Browse files Browse the repository at this point in the history
…der venom
  • Loading branch information
danielcasta0398 committed Dec 12, 2022
1 parent 091544a commit fee7c2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/packages/*/node_modules
/packages/*/dist
/packages/*/docs/dist
/packages/provider/src/venom/tokens
session.json
chats/*
!chats/.gitkeep
Expand Down
25 changes: 25 additions & 0 deletions packages/provider/src/venom/index.js
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)
}
}

0 comments on commit fee7c2e

Please sign in to comment.