From 91b2c401d77b374d72517c482d5807f3f745a99b Mon Sep 17 00:00:00 2001 From: gekkedev <17025257+gekkedev@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:13:43 +0200 Subject: [PATCH] docs: Translated example code (#2226) --- docs/getting-started/configuring-logger.md | 2 +- docs/getting-started/installation.md | 4 ++++ docs/getting-started/receiving-messages.md | 6 +++--- examples/basic/index.js | 10 +++++----- examples/bot-functions/index.js | 20 ++++++++++---------- examples/newsletter/index.js | 6 +++--- examples/orders/index.js | 6 +++--- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/docs/getting-started/configuring-logger.md b/docs/getting-started/configuring-logger.md index 0c91e9b18..a4409e225 100644 --- a/docs/getting-started/configuring-logger.md +++ b/docs/getting-started/configuring-logger.md @@ -79,7 +79,7 @@ const files = new winston.transports.File({ filename: 'combined.log' }); wppconnect.defaultLogger.add(files); // Add file transport //Optional: create a custom console with error level -const console = new winston.transports.Console({ level: 'erro' }); +const console = new winston.transports.Console({ level: 'error' }); wppconnect.defaultLogger.add(console); // Add console transport //Optional: Remove the custom transport diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 0dee56f67..0523f3eae 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -5,6 +5,10 @@ The first thing that you had to do is install the `npm package`: ```bash npm i --save @wppconnect-team/wppconnect ``` +or with Yarn: +```bash +yarn add @wppconnect-team/wppconnect +``` or for [Nightly releases](https://github.com/wppconnect-team/wppconnect/releases/tag/nightly): diff --git a/docs/getting-started/receiving-messages.md b/docs/getting-started/receiving-messages.md index c3ba60e65..cdc6c2017 100644 --- a/docs/getting-started/receiving-messages.md +++ b/docs/getting-started/receiving-messages.md @@ -18,10 +18,10 @@ function start(client) { client .sendText(message.from, 'Hello, how I may help you?') .then((result) => { - console.log('Result: ', result); //return object success + console.log('Result: ', result); //return success object }) - .catch((erro) => { - console.error('Error when sending: ', erro); //return object error + .catch((error) => { + console.error('Error when sending: ', error); //return error object }); } }); diff --git a/examples/basic/index.js b/examples/basic/index.js index b2c1eb0ad..376dfc12b 100644 --- a/examples/basic/index.js +++ b/examples/basic/index.js @@ -19,18 +19,18 @@ const wppconnect = require('../../dist'); wppconnect .create() .then((client) => start(client)) - .catch((erro) => { - console.log(erro); + .catch((error) => { + console.log(error); }); function start(client) { client.onMessage((message) => { if (message.body === 'Hi' && message.isGroupMsg === false) { client - .sendText(message.from, 'Welcome Wppconnect') + .sendText(message.from, 'Welcome to Wppconnect') .then((result) => {}) - .catch((erro) => { - console.error('Error when sending: ', erro); //return object error + .catch((error) => { + console.error('Error when sending: ', error); //return error object }); } }); diff --git a/examples/bot-functions/index.js b/examples/bot-functions/index.js index e7500d1f0..c7bb98ed8 100644 --- a/examples/bot-functions/index.js +++ b/examples/bot-functions/index.js @@ -18,7 +18,7 @@ const wppconnect = require('../../dist'); wppconnect .create({ - session: 'teste', + session: 'test', onLoadingScreen: (percent, message) => { console.log('LOADING_SCREEN', percent, message); }, @@ -84,30 +84,30 @@ function start(client) { await client.setChatState(msg.from, '2'); } } else if (msg.body.startsWith('!btn')) { - await client.sendMessageOptions(msg.from, 'teste', { - title: 'CALÇA JEN FEMININA', - footer: 'Escolha uma opção abaixo', + await client.sendMessageOptions(msg.from, 'test', { + title: "WOMEN'S JEANS PANTS", + footer: 'Choose an option below', isDynamicReplyButtonsMsg: true, dynamicReplyButtons: [ { - buttonId: 'idSim', + buttonId: 'idYes', buttonText: { - displayText: 'SIM', + displayText: 'YES', }, type: 1, }, { - buttonId: 'idNao', + buttonId: 'idNo', buttonText: { - displayText: 'NÃO', + displayText: 'NO', }, type: 1, }, ], }); } - } catch (e) { - console.log(e); + } catch (error) { + console.log(error); } }); } diff --git a/examples/newsletter/index.js b/examples/newsletter/index.js index 988a88dbc..28448b6e3 100644 --- a/examples/newsletter/index.js +++ b/examples/newsletter/index.js @@ -18,11 +18,11 @@ const wppconnect = require('../../dist'); wppconnect .create({ - session: 'teste', + session: 'test', }) .then((client) => start(client)) - .catch((erro) => { - console.log(erro); + .catch((error) => { + console.log(error); }); function start(client) { diff --git a/examples/orders/index.js b/examples/orders/index.js index c5b551930..db3b21cba 100644 --- a/examples/orders/index.js +++ b/examples/orders/index.js @@ -20,8 +20,8 @@ const froms = []; wppconnect .create() .then((client) => start(client)) - .catch((erro) => { - console.log(erro); + .catch((error) => { + console.log(error); }); function start(client) { @@ -33,7 +33,7 @@ function start(client) { froms.push(message.from); client.sendText( message.from, - `Please, save your order id, and get order for test porpouse` + `Please save your order ID, and get your order for testing purposes` ); client.sendText(message.from, `${order.id}`); }