forked from orkestral/venom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
191 additions
and
78 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,4 +1,3 @@ | ||
|
||
# 🕷Venom Bot🕸 | ||
|
||
[![npm version](https://img.shields.io/npm/v/venom-bot.svg?color=green)](https://www.npmjs.com/package/venom-bot) | ||
|
@@ -14,14 +13,12 @@ | |
|
||
> Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp. | ||
|
||
## Get started fast and easy! Official API! | ||
|
||
<p align="center"> | ||
<a href="https://docs.orkestral.io/venom">Full Documentation</a> | ||
</p> | ||
|
||
|
||
<p> | ||
It's a high-performance alternative API to whatzapp, you can send, text messages, files, images, videos and more. | ||
</p> | ||
|
@@ -47,8 +44,8 @@ Use it in your favorite language like PHP, Python, C# and others. as long as you | |
|
||
<a target="_blank" href="https://discord.gg/uBRjk6vecs" target="_blank"><img title="Discord" height="110" width="375" src="https://s2.glbimg.com/GUbCgnBxJERAmuaYcrjBzTXD5ws=/0x0:800x272/984x0/smart/filters:strip_icc()/i.s3.glbimg.com/v1/AUTH_63b422c2caee4269b8b34177e8876b93/internal_photos/bs/2021/d/N/zJs579QOGxKVRxfPILCA/discord-app.png"></a> | ||
|
||
|
||
## Meet the Superchats | ||
|
||
<br> | ||
<a href='https://github.com/orkestral/superchats'><img src='https://github.com/orkestral/superchats/raw/main/img/superchats.png' height='60' alt='SuperChats' aria-label='https://github.com/orkestral/superchats' /></a> | ||
<br> | ||
|
@@ -69,21 +66,21 @@ The value of the license is $50 monthly dollars, to acquire contact in whatsapp | |
|
||
## 🕷🕷 Functions Venom🕷🕷 | ||
|
||
| | | | ||
|---------------------------------------------------------------|---| | ||
| 🚻 Automatic QR Refresh | ✔ | | ||
| 📁 Send **text, image, video, audio and docs** | ✔ | | ||
| 👥 Get **contacts, chats, groups, group members, Block List** | ✔ | | ||
| 📞 Send contacts | ✔ | | ||
| Send Buttons | ✔ | | ||
| Send stickers | ✔ | | ||
| Send stickers GIF | ✔ | | ||
| Multiple Sessions | ✔ | | ||
| ⏩ Forward Messages | ✔ | | ||
| 📥 Receive message | ✔ | | ||
| 👤 insert user section | ✔ | | ||
| 📍 Send location!! | ✔ | | ||
| 🕸🕸 **and much more** | ✔ | | ||
| | | | ||
| ------------------------------------------------------------- | --- | | ||
| 🚻 Automatic QR Refresh | ✔ | | ||
| 📁 Send **text, image, video, audio and docs** | ✔ | | ||
| 👥 Get **contacts, chats, groups, group members, Block List** | ✔ | | ||
| 📞 Send contacts | ✔ | | ||
| Send Buttons | ✔ | | ||
| Send stickers | ✔ | | ||
| Send stickers GIF | ✔ | | ||
| Multiple Sessions | ✔ | | ||
| ⏩ Forward Messages | ✔ | | ||
| 📥 Receive message | ✔ | | ||
| 👤 insert user section | ✔ | | ||
| 📍 Send location!! | ✔ | | ||
| 🕸🕸 **and much more** | ✔ | | ||
|
||
Documentation at https://orkestral.github.io/venom/index.html | ||
|
||
|
@@ -114,7 +111,7 @@ const venom = require('venom-bot'); | |
|
||
venom | ||
.create({ | ||
session: 'session-name', //name of session | ||
session: 'session-name' //name of session | ||
}) | ||
.then((client) => start(client)) | ||
.catch((erro) => { | ||
|
@@ -201,7 +198,7 @@ venom | |
userProxy: '', // Proxy login username | ||
userPass: '' // Proxy password | ||
}, | ||
|
||
// BrowserInstance | ||
(browser, waPage) => { | ||
console.log('Browser PID:', browser.process().pid); | ||
|
@@ -221,7 +218,7 @@ venom | |
Gets the return if the session is `isLogged` or `notLogged` or `browserClose` or `qrReadSuccess` or `qrReadFail` or `autocloseCalled` or `desconnectedMobile` or `deleteToken` or `chatsAvailable` or `deviceNotConnected` or `serverWssNotConnected` or `noOpenBrowser` or `initBrowser` or `openBrowser` or `connectBrowserWs` or `initWhatsapp` or `erroPageWhatsapp` or `successPageWhatsapp` or `waitForLogin` or `waitChat` or `successChat` or `Create session wss return "serverClose" case server for close` | ||
|
||
| Status | Condition | | ||
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `isLogged` | When the user is already logged in to the browser | | ||
| `notLogged` | When the user is not connected to the browser, it is necessary to scan the QR code through the cell phone in the option WhatsApp Web | | ||
| `browserClose` | If the browser is closed this parameter is returned | | ||
|
@@ -230,7 +227,7 @@ Gets the return if the session is `isLogged` or `notLogged` or `browserClose` or | |
| `autocloseCalled` | The browser was closed using the autoClose command | | ||
| `desconnectedMobile` | Client has desconnected in to mobile | | ||
| `serverClose` | Client has desconnected in to wss | | ||
| `deleteToken` | If you pass true within the function | | ||
| `deleteToken` | If you pass true within the function | | ||
| `chatsAvailable` | When Venom is connected to the chat list | | ||
| `deviceNotConnected` | Chat not available because the phone is disconnected `(Trying to connect to the phone)` | | ||
| `serverWssNotConnected` | The address wss was not found! | | ||
|
@@ -243,20 +240,17 @@ Gets the return if the session is `isLogged` or `notLogged` or `browserClose` or | |
| `successPageWhatsapp` | Page Whatsapp successfully accessed | | ||
| `waitForLogin` | Waiting for login verification! | | ||
| `waitChat` | Waiting for the chat to load | | ||
| `successChat` | Chat successfully loaded! | | ||
| `successChat` | Chat successfully loaded! | | ||
|
||
```javascript | ||
const venom = require('venom-bot'); | ||
venom | ||
.create( | ||
'sessionName', | ||
undefined, | ||
(statusSession, session) => { | ||
console.log('Status Session: ', statusSession); | ||
//return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken || chatsAvailable || deviceNotConnected || serverWssNotConnected || noOpenBrowser || initBrowser || openBrowser || connectBrowserWs || initWhatsapp || erroPageWhatsapp || successPageWhatsapp || waitForLogin || waitChat || successChat | ||
//Create session wss return "serverClose" case server for close | ||
console.log('Session name: ', session); | ||
}, | ||
) | ||
.create('sessionName', undefined, (statusSession, session) => { | ||
console.log('Status Session: ', statusSession); | ||
//return isLogged || notLogged || browserClose || qrReadSuccess || qrReadFail || autocloseCalled || desconnectedMobile || deleteToken || chatsAvailable || deviceNotConnected || serverWssNotConnected || noOpenBrowser || initBrowser || openBrowser || connectBrowserWs || initWhatsapp || erroPageWhatsapp || successPageWhatsapp || waitForLogin || waitChat || successChat | ||
//Create session wss return "serverClose" case server for close | ||
console.log('Session name: ', session); | ||
}) | ||
.then((client) => { | ||
start(client); | ||
}) | ||
|
@@ -345,6 +339,27 @@ available can be found in [here](/src/api/layers) and | |
|
||
```javascript | ||
|
||
// Send Poll | ||
const poll = { | ||
name: 'new poll', | ||
options: [ | ||
{ | ||
name: 'option 1' | ||
}, | ||
{ | ||
name: 'option 2' | ||
} | ||
], | ||
selectableOptionsCount: 1 | ||
}; | ||
await client.sendPollCreation('[email protected]', poll) | ||
.then((result) => { | ||
console.log('Result: ', result); //return object success | ||
}) | ||
.catch((erro) => { | ||
console.error('Error when sending: ', erro); //return object error | ||
}); | ||
|
||
// Send List menu | ||
const list = [ | ||
{ | ||
|
@@ -694,12 +709,14 @@ const url = await client.getProfilePicFromServer('[email protected]'); | |
const chat = await client.getChat('[email protected]'); | ||
|
||
// Check if the number exists | ||
const chat = await client.checkNumberStatus('[email protected]') | ||
.then((result) => { | ||
const chat = await client | ||
.checkNumberStatus('[email protected]') | ||
.then((result) => { | ||
console.log('Result: ', result); //return object success | ||
}).catch((erro) => { | ||
}) | ||
.catch((erro) => { | ||
console.error('Error when sending: ', erro); //return object error | ||
}); | ||
}); | ||
``` | ||
|
||
## Group Functions | ||
|
@@ -771,13 +788,11 @@ await client.setProfilePic('path/to/image.jpg'); | |
|
||
// Get device info | ||
await client.getHostDevice(); | ||
|
||
``` | ||
|
||
## Device Functions | ||
|
||
```javascript | ||
|
||
// Disconnect from service | ||
await client.logout(); | ||
|
||
|
@@ -946,7 +961,6 @@ await client.blockContact('[email protected]'); | |
|
||
// Unlocks contacts (returns true if it works) | ||
await client.unblockContact('[email protected]'); | ||
|
||
``` | ||
## Misc | ||
|
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
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 |
---|---|---|
|
@@ -111,6 +111,26 @@ export class SenderLayer extends ListenerLayer { | |
}); | ||
} | ||
|
||
/** | ||
* Create poll | ||
* @param idUser chat id: [email protected] | ||
*/ | ||
public async sendPollCreation(idUser: string, poll: any) { | ||
return new Promise(async (resolve, reject) => { | ||
const result = await this.page.evaluate( | ||
({ idUser, poll }) => { | ||
return WAPI.sendPollCreation(idUser, poll); | ||
}, | ||
{ idUser, poll } | ||
); | ||
if (result['erro'] == true) { | ||
return reject(result); | ||
} else { | ||
return resolve(result); | ||
} | ||
}); | ||
} | ||
|
||
//*PRO_ | ||
/** | ||
* @param filePath path, http link or base64Encoded | ||
|
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,51 @@ | ||
export async function pollCreation(idUser, poll) { | ||
if (typeof poll !== 'object') { | ||
return WAPI.scope(idUser, true, 404, 'poll must be an object'); | ||
} | ||
if (!poll?.name) { | ||
return WAPI.scope(idUser, true, 404, 'Missing object name'); | ||
} | ||
if (!poll?.options) { | ||
return WAPI.scope(idUser, true, 404, 'Missing object options'); | ||
} | ||
if ( | ||
typeof poll.selectableOptionsCount !== 'number' || | ||
(poll.selectableOptionsCount !== 1 && poll.selectableOptionsCount !== 0) | ||
) { | ||
return WAPI.scope( | ||
idUser, | ||
true, | ||
404, | ||
'Error checking selectableOptionsCount!' | ||
); | ||
} | ||
|
||
const options = poll.options; | ||
if (Array.isArray(options) && options.length > 0) { | ||
for (let index in options) { | ||
if (typeof options[index] !== 'function') { | ||
if (!options[index].name) { | ||
return WAPI.scope(idUser, true, 404, 'Missing object name'); | ||
} | ||
if (typeof options[index].name !== 'string') { | ||
return WAPI.scope(idUser, true, 404, 'Passed string value in name'); | ||
} | ||
} | ||
} | ||
} | ||
|
||
const chat = await WAPI.sendExist(idUser); | ||
if (chat && chat.status !== 404 && chat.id) { | ||
await Store.Survey.sendPollCreation({ | ||
chat: chat, | ||
poll: poll, | ||
quotedMsg: null | ||
}); | ||
return { error: false, lastReceivedKey: chat.lastReceivedKey }; | ||
} else { | ||
if (!chat.error) { | ||
chat.error = true; | ||
} | ||
return chat; | ||
} | ||
} |
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,8 @@ | ||
export function addOnPoll() { | ||
window.WAPI.onPoll = function (callback) { | ||
Store.PollVote.on('change', (e) => { | ||
callback(e); | ||
}); | ||
return true; | ||
}; | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.