Skip to content

Commit d14df96

Browse files
committed
✨ ✨ ✨ ✨ DOCS V3 INIT ✨ ✨ ✨ ✨
1 parent 43b1f00 commit d14df96

File tree

241 files changed

+49809
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+49809
-0
lines changed

docs-v3/.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

docs-v3/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

docs-v3/babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
slug: first-blog-post
3+
title: First Blog Post
4+
authors:
5+
name: Gao Wei
6+
title: Docusaurus Core Team
7+
url: https://github.com/wgao19
8+
image_url: https://github.com/wgao19.png
9+
tags: [hola, docusaurus]
10+
---
11+
12+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
slug: long-blog-post
3+
title: Long Blog Post
4+
authors: endi
5+
tags: [hello, docusaurus]
6+
---
7+
8+
This is the summary of a very long blog post,
9+
10+
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
11+
12+
<!--truncate-->
13+
14+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
15+
16+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
17+
18+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
19+
20+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
21+
22+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
23+
24+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
25+
26+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
27+
28+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
29+
30+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
31+
32+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
33+
34+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
35+
36+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
37+
38+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
39+
40+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
41+
42+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
43+
44+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
slug: mdx-blog-post
3+
title: MDX Blog Post
4+
authors: [slorber]
5+
tags: [docusaurus]
6+
---
7+
8+
Blog posts support [Docusaurus Markdown features](https://docusaurus.io/docs/markdown-features), such as [MDX](https://mdxjs.com/).
9+
10+
:::tip
11+
12+
Use the power of React to create interactive blog posts.
13+
14+
```js
15+
<button onClick={() => alert('button clicked!')}>Click me!</button>
16+
```
17+
18+
<button onClick={() => alert('button clicked!')}>Click me!</button>
19+
20+
:::
Loading
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
slug: welcome
3+
title: Welcome
4+
authors: [slorber, yangshun]
5+
tags: [facebook, hello, docusaurus]
6+
---
7+
8+
9+
Simply add Markdown files (or folders) to the `blog` directory.
10+
11+
Regular blog authors can be added to `authors.yml`.
12+
13+
The blog post date can be extracted from filenames, such as:
14+
15+
- `2019-05-30-welcome.md`
16+
- `2019-05-30-welcome/index.md`
17+
18+
A blog post folder can be convenient to co-locate blog post images:
19+
20+
![Docusaurus Plushie](./docusaurus-plushie-banner.jpeg)
21+
22+
The blog supports tags as well!
23+
24+
**And if you don't want a blog**: just delete this directory, and use `blog: false` in your Docusaurus config.

docs-v3/blog/authors.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
endi:
2+
name: Endilie Yacop Sucipto
3+
title: Maintainer of Docusaurus
4+
url: https://github.com/endiliey
5+
image_url: https://github.com/endiliey.png
6+
7+
yangshun:
8+
name: Yangshun Tay
9+
title: Front End Engineer @ Facebook
10+
url: https://github.com/yangshun
11+
image_url: https://github.com/yangshun.png
12+
13+
slorber:
14+
name: Sébastien Lorber
15+
title: Docusaurus maintainer
16+
url: https://sebastienlorber.com
17+
image_url: https://github.com/slorber.png
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Best Practice
2+
3+
Since this is not an officially sanctioned solution it is temperamental to say the least. Here are some best practices:
4+
5+
1. Keep the session alive
6+
2. Offload most work off of your @open-wa/wa-automate setup (i.e forward all events to a pubsub or something)
7+
3. Keep the phone nearby just in case you need to reauthenticate
8+
4. Use a chrome instance instead of the default chromium instance
9+
5. Use headless: false for easy & quick visual debugging
10+
6. Implement the unread messages functionality on creation of a session so you don't miss any messages upon any downtime.
11+
7. Implement a [promise-queue](https://github.com/sindresorhus/p-queue)
12+
8. Use a unique and valid custom user-agent
13+
9. ```await``` all @open-wa/wa-automate methods just in case
14+
10. Do not run your s@open-wa/wa-automate instance on a Windows machine.
15+
11. Always [kill the session safely](https://open-wa.github.io/wa-automate-nodejs/classes/client.html#kill) upon error or SIGINT.
16+
12. Regularly restart your process to manage memory consumption
17+
13. If memory leaks continue to be an issue then use `cacheEnabled:false` in the config to disable the cache on the page.
18+
19+
```javascript
20+
import { create, Client} from '@open-wa/wa-automate';
21+
const { default: PQueue } = require("p-queue");
22+
23+
const queue = new PQueue({
24+
concurrency: 4,
25+
autoStart:false
26+
});
27+
28+
const proc = async message => {
29+
//do something with the message here
30+
console.log(message)
31+
return true;
32+
}
33+
34+
const processMessage = message => queue.add(()=>proc(message));
35+
36+
async function start(client: Client) {
37+
const unreadMessages = await client.getAllUnreadMessages();
38+
unreadMessages.forEach(processMessage)
39+
...
40+
await client.onMessage(processMessage);
41+
queue.start();
42+
}
43+
44+
create().then(client => start(client));
45+
46+
//create takes 1 argument and that is the config object :
47+
// https://docs.openwa.dev/interfaces/api_model_config.ConfigObject.html
48+
49+
create({
50+
// For Mac:
51+
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
52+
// For Windows:
53+
// executablePath: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
54+
headless: false,
55+
autoRefresh:true,
56+
cacheEnabled:false,
57+
customUserAgent: 'some custom user agent'
58+
})
59+
.then(client => start(client));
60+
```

docs-v3/docs/api/_category_.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: "API Reference"
2+
position: 0
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
label: "Classes"
2+
position: 3

0 commit comments

Comments
 (0)