Skip to content

Commit

Permalink
feat: new example
Browse files Browse the repository at this point in the history
  • Loading branch information
joaosouz4dev committed Nov 30, 2020
1 parent 997e462 commit ea45fa5
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 13 deletions.
4 changes: 4 additions & 0 deletions examples/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
tokens
package-lock.json
debug.log
13 changes: 13 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 23 additions & 0 deletions examples/basic/index.js
Original file line number Diff line number Diff line change
@@ -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
});
}
});
}
11 changes: 11 additions & 0 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions examples/bot-functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| `!ping reply` | pong like reply |
| `!chats` | total chats opened |
| `!info` | infos about connection |
| `!location` | send location |
| `!sendto <number> <msg>` | send msg to some number |
| `!pin <true or false>` | freeze this chat |
| `!typing <true or false>` | change state chat to typing |
Expand Down
13 changes: 1 addition & 12 deletions examples/bot-functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea45fa5

Please sign in to comment.