-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(project): refact dispatch command (#92)
- Loading branch information
1 parent
f497c42
commit 429fc20
Showing
6 changed files
with
29 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
github: [caioagiani] | ||
custom: ['https://nubank.com.br/pagar/3lf5k/hgTQsUWzua'] |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
.env | ||
|
||
dist | ||
node_modules | ||
|
||
yarn.lock | ||
|
||
*.lock | ||
src/config/integrantes.json | ||
|
||
.idea | ||
|
||
.wwebjs_auth | ||
.wwebjs_auth | ||
src/data/* | ||
!src/data/.gitkeep |
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
Empty file.
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 |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import { Client, MessageMedia, LocalAuth } from 'whatsapp-web.js'; | ||
import * as qrcode from 'qrcode-terminal'; | ||
import { resolve } from 'path'; | ||
|
||
const client = new Client({ | ||
authStrategy: new LocalAuth(), | ||
authStrategy: new LocalAuth({ | ||
clientId: 'wpp-bot', | ||
dataPath: resolve(__dirname, '..', 'data'), | ||
}), | ||
puppeteer: { | ||
headless: true, | ||
args: ['--no-sandbox'], | ||
}, | ||
}); | ||
|
||
client.on('qr', async (qr) => qrcode.generate(qr, { small: true })); | ||
client.on('authenticated', () => console.log('authenticated')); | ||
client.on('auth_failure', () => console.log('Authentication failed.')); | ||
client.on('authenticated', () => console.log('WhatsApp authenticated.')); | ||
client.on('auth_failure', () => console.log('WhatsApp authentication failed.')); | ||
client.on('disconnected', () => console.log('WhatsApp lost connection.')); | ||
client.on('ready', async () => { | ||
await client.sendMessage( | ||
'[email protected]', | ||
`[${client.info.pushname}] - WhatsApp Online\n[x] Please, *like* project: https://github.com/caioagiani/whatsapp-bot`, | ||
`[${client.info.pushname}] - WhatsApp Online\n\n[⭐] Please *like* this project: https://github.com/caioagiani/whatsapp-bot\n\n[💝] Sponsor this SourceCode: https://github.com/sponsors/caioagiani`, | ||
); | ||
|
||
console.log('WhatsApp bot successfully connected!'); | ||
|