diff --git a/examples/basic/.gitignore b/examples/basic/.gitignore new file mode 100644 index 000000000..27826cf8a --- /dev/null +++ b/examples/basic/.gitignore @@ -0,0 +1,4 @@ +node_modules +tokens +package-lock.json +debug.log \ No newline at end of file diff --git a/examples/basic/README.md b/examples/basic/README.md new file mode 100644 index 000000000..36805722c --- /dev/null +++ b/examples/basic/README.md @@ -0,0 +1,13 @@ +# Simple example to start the Venom + +> 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. + +## Maintainers + +Maintainers are needed, I cannot keep with all the updates by myself. If you are +interested please open a Pull Request. + +## Contributing + +Pull requests are welcome. For major changes, please open an issue first to +discuss what you would like to change. diff --git a/examples/basic/index.js b/examples/basic/index.js new file mode 100644 index 000000000..b345b14c1 --- /dev/null +++ b/examples/basic/index.js @@ -0,0 +1,23 @@ +const venom = require('../../dist'); + +venom + .create() + .then((client) => start(client)) + .catch((erro) => { + console.log(erro); + }); + +function start(client) { + client.onMessage((message) => { + if (message.body === 'Hi' && message.isGroupMsg === false) { + client + .sendText(message.from, 'Welcome Venom 🕷') + .then((result) => { + console.log('Result: ', result); //return object success + }) + .catch((erro) => { + console.error('Error when sending: ', erro); //return object error + }); + } + }); +} diff --git a/examples/basic/package.json b/examples/basic/package.json new file mode 100644 index 000000000..e2c77d0ab --- /dev/null +++ b/examples/basic/package.json @@ -0,0 +1,11 @@ +{ + "name": "venom-bot-functions", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "node index.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "license": "ISC" +} diff --git a/examples/bot-functions/README.md b/examples/bot-functions/README.md index dcd07a907..dbef5fd79 100644 --- a/examples/bot-functions/README.md +++ b/examples/bot-functions/README.md @@ -8,6 +8,7 @@ | `!ping reply` | pong like reply | | `!chats` | total chats opened | | `!info` | infos about connection | +| `!location` | send location | | `!sendto ` | send msg to some number | | `!pin ` | freeze this chat | | `!typing ` | change state chat to typing | diff --git a/examples/bot-functions/package.json b/examples/bot-functions/package.json index 0b8d7985c..0bbb2dbff 100644 --- a/examples/bot-functions/package.json +++ b/examples/bot-functions/package.json @@ -7,18 +7,7 @@ "start": "node index.js", "test": "echo \"Error: no test specified\" && exit 1" }, - "repository": { - "type": "git", - "url": "git+https://github.com/joaosouz4dev/venom-bot-functions.git" - }, "keywords": [], "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/joaosouz4dev/venom-bot-functions/issues" - }, - "homepage": "https://github.com/joaosouz4dev/venom-bot-functions#readme", - "dependencies": { - "venom-bot": "^2.0.18" - } + "license": "ISC" } diff --git a/package-lock.json b/package-lock.json index 4b0432570..277fb6812 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10050,7 +10050,7 @@ }, "rimraf": { "version": "3.0.2", - "resolved": "http://localhost:4873/rimraf/-/rimraf-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "requires": { "glob": "^7.1.3"