Skip to content

Commit 5a909e1

Browse files
committed
fix README.md
1 parent ebf05f3 commit 5a909e1

File tree

2 files changed

+260
-3
lines changed

2 files changed

+260
-3
lines changed

README.md

Lines changed: 260 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,216 @@
1-
## How to use
1+
# java-wechaty
2+
3+
![Java Wechaty](https://wechaty.github.io/java-wechaty/images/java-wechaty.png)
4+
5+
## Connecting Chatbots
6+
7+
[![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg)](https://github.com/Wechaty/wechaty)
8+
9+
Wechaty is a RPA SDK for Wechat **Individual** Account that can help you create a chatbot in 6 lines of Java.
10+
11+
## WORK IN PROGRESS
12+
13+
Work in progress...
14+
15+
Please come back after 4 weeks...
16+
17+
## Voice of the Developers
18+
19+
> "Wechaty is a great solution, I believe there would be much more users recognize it." [link](https://github.com/Wechaty/wechaty/pull/310#issuecomment-285574472)
20+
> &mdash; <cite>@Gcaufy, Tencent Engineer, Author of [WePY](https://github.com/Tencent/wepy)</cite>
21+
>
22+
> "太好用,好用的想哭"
23+
> &mdash; <cite>@xinbenlv, Google Engineer, Founder of HaoShiYou.org</cite>
24+
>
25+
> "最好的微信开发库" [link](http://weibo.com/3296245513/Ec4iNp9Ld?type=comment)
26+
> &mdash; <cite>@Jarvis, Baidu Engineer</cite>
27+
>
28+
> "Wechaty让运营人员更多的时间思考如何进行活动策划、留存用户,商业变现" [link](http://mp.weixin.qq.com/s/dWHAj8XtiKG-1fIS5Og79g)
29+
> &mdash; <cite>@lijiarui, Founder & CEO of Juzi.BOT.</cite>
30+
>
31+
> "If you know js ... try Wechaty, it's easy to use."
32+
> &mdash; <cite>@Urinx Uri Lee, Author of [WeixinBot(Python)](https://github.com/Urinx/WeixinBot)</cite>
33+
34+
See more at [Wiki:Voice Of Developer](https://github.com/Wechaty/wechaty/wiki/Voice%20Of%20Developer)
35+
36+
## Join Us
37+
38+
Wechaty is used in many ChatBot projects by thousands of developers. If you want to talk with other developers, just scan the following QR Code in WeChat with secret code _java wechaty_, join our **Wechaty Java Developers' Home**.
39+
40+
![Wechaty Java Developers' Home](https://wechaty.github.io/wechaty/images/bot-qr-code.png)
41+
42+
Scan now, because other Wechaty Java developers want to talk with you too! (secret code: _java wechaty_)
43+
44+
## The World's Shortest Java ChatBot: 6 lines of Code
45+
46+
```java
47+
class Bot{
48+
public static void main(String args[]){
49+
bot = Wechaty.instance()
50+
.on('scan', (qrcode, status, string) -> System.out.println('Scan QR Code to login: %s\nhttps://api.qrserver.com/v1/create-qr-code/?data=%s', status, encodeURIComponent(qrcode)))
51+
.on('login', user -> System.out.println('User %s logined', user))
52+
.on('message', message -> System.out.println('Message: %s', message))
53+
.start();
54+
}
55+
}
56+
```
57+
58+
## Java Wechaty Developing Plan
59+
60+
We already have Wechaty in TypeScript, It will be not too hard to translate the TypeScript(TS) to Java because [wechaty](https://github.com/wechaty/wechaty) has only 3,000 lines of the TS code, they are well designed and de-coupled by the [wechaty-puppet](https://github.com/wechaty/wechaty-puppet/) abstraction. So after we have translated those 3,000 lines of TypeScript code, we will almost be done.
61+
62+
As we have already a ecosystem of Wechaty in TypeScript, so we will not have to implement everything in Java, especially, in the Feb 2020, we have finished the [@chatie/grpc](https://github.com/chatie/grpc) service abstracting module with the [wechaty-puppet-hostie](https://github.com/wechaty/wechaty-puppet-hostie) implmentation.
63+
64+
The following diagram shows out that we can reuse almost everything in TypeScript, and what we need to do is only the block located at the top right of the diagram: `Wechaty (Java)`.
65+
66+
```ascii
67+
+--------------------------+ +--------------------------+
68+
| | | |
69+
| Wechaty (TypeScript) | | Wechaty (Java) |
70+
| | | |
71+
+--------------------------+ +--------------------------+
72+
73+
+-------------------------------------------------------+
74+
| Wechaty Puppet Hostie |
75+
| |
76+
| (wechaty-puppet-hostie) |
77+
+-------------------------------------------------------+
78+
79+
+--------------------- @chatie/grpc ----------------------+
80+
81+
+-------------------------------------------------------+
82+
| Wechaty Puppet Abstract |
83+
| |
84+
| (wechaty-puppet) |
85+
+-------------------------------------------------------+
86+
87+
+--------------------------+ +--------------------------+
88+
| Pad Protocol | | Web Protocol |
89+
| | | |
90+
| wechaty-puppet-padplus | |(wechaty-puppet-puppeteer)|
91+
+--------------------------+ +--------------------------+
92+
+--------------------------+ +--------------------------+
93+
| Windows Protocol | | Mac Protocol |
94+
| | | |
95+
| (wechaty-puppet-windows) | | (wechaty-puppet-macpro) |
96+
+--------------------------+ +--------------------------+
97+
```
98+
99+
## Example: How to Translate TypeScript to Java
100+
101+
There's a 100 lines class named `Image` in charge of downloading the WeChat image to different sizes.
102+
103+
It is a great example for demonstrating how do we translate the TypeScript to Java in Wechaty Way:
104+
105+
### Image Class Source Code
106+
107+
- TypeScript: <https://github.com/wechaty/wechaty/blob/master/src/user/image.ts>
108+
- Java: <https://github.com/wechaty/java-wechaty/blob/master/src/wechaty/user/image.py>
109+
110+
If you are interested in the translation and want to look at how it works, it will be a good start from reading and comparing those two `Image` class files in TypeScript and Java at the same time.
111+
112+
## To-do List
113+
114+
- TS: TypeScript
115+
- SLOC: Source Lines Of Code
116+
117+
### Wechaty Internal Modules
118+
119+
1. [ ] Class Wechaty
120+
- TS SLOC(1160): <https://github.com/wechaty/wechaty/blob/master/src/wechaty.ts>
121+
- [ ] Code
122+
- [ ] Unit Tests
123+
- [ ] Documentation
124+
1. [ ] Class Contact
125+
- TS SLOC(804): <https://github.com/wechaty/wechaty/blob/master/src/user/contact.ts>
126+
- [x] Code
127+
- [ ] Unit Tests
128+
- [ ] Documentation
129+
1. [ ] Class ContactSelf
130+
- TS SLOC(199): <https://github.com/wechaty/wechaty/blob/master/src/user/contact-self.ts>
131+
- [x] Code
132+
- [ ] Unit Tests
133+
- [ ] Documentation
134+
1. [ ] Class Message
135+
- TS SLOC(1054): <https://github.com/wechaty/wechaty/blob/master/src/user/message.ts>
136+
- [x] Code
137+
- [ ] Unit Tests
138+
- [ ] Documentation
139+
1. [ ] Class Room
140+
- TS SLOC(1194): <https://github.com/wechaty/wechaty/blob/master/src/user/room.ts>
141+
- [x] Code
142+
- [ ] Unit Tests
143+
- [ ] Documentation
144+
1. [ ] Class Image
145+
- TS SLOC(60): <https://github.com/wechaty/wechaty/blob/master/src/user/image.ts>
146+
- [x] Code
147+
- [ ] Unit Tests
148+
- [ ] Documentation
149+
1. [ ] Class Accessory
150+
- TS SLOC(179): <https://github.com/wechaty/wechaty/blob/master/src/accessory.ts>
151+
- [x] Code
152+
- [ ] Unit Tests
153+
- [ ] Documentation
154+
1. [ ] Class Config
155+
- TS SLOC(187): <https://github.com/wechaty/wechaty/blob/master/src/config.ts>
156+
- [ ] Code
157+
- [ ] Unit Tests
158+
- [ ] Documentation
159+
1. [ ] Class Favorite
160+
- TS SLOC(52): <https://github.com/wechaty/wechaty/blob/master/src/user/favorite.ts>
161+
- [ ] Code
162+
- [ ] Unit Tests
163+
- [ ] Documentation
164+
1. [ ] Class Friendship
165+
- TS SLOC(417): <https://github.com/wechaty/wechaty/blob/master/src/user/friendship.ts>
166+
- [x] Code
167+
- [ ] Unit Tests
168+
- [ ] Documentation
169+
1. [ ] Class MiniProgram
170+
- TS SLOC(70): <https://github.com/wechaty/wechaty/blob/master/src/user/mini-program.ts>
171+
- [ ] Code
172+
- [ ] Unit Tests
173+
- [ ] Documentation
174+
1. [ ] Class RoomInvitation
175+
- TS SLOC(317): <https://github.com/wechaty/wechaty/blob/master/src/user/room-invitation.ts>
176+
- [ ] Code
177+
- [ ] Unit Tests
178+
- [ ] Documentation
179+
1. [ ] Class Tag
180+
- TS SLOC(190): <https://github.com/wechaty/wechaty/blob/master/src/user/tag.ts>
181+
- [x] Code
182+
- [ ] Unit Tests
183+
- [ ] Documentation
184+
1. [ ] Class UrlLink
185+
- TS SLOC(107): <https://github.com/wechaty/wechaty/blob/master/src/user/url-link.ts>
186+
- [ ] Code
187+
- [ ] Unit Tests
188+
- [ ] Documentation
189+
190+
### Wechaty External Modules
191+
192+
1. [ ] Class FileBox
193+
- TS SLOC(638): <https://github.com/huan/file-box/blob/master/src/file-box.ts>
194+
- [ ] Code
195+
- [ ] Unit Tests
196+
- [ ] Documentation
197+
1. [ ] Class MemoryCard
198+
- TS SLOC(376): <https://github.com/huan/memory-card/blob/master/src/memory-card.ts>
199+
- [ ] Code
200+
- [ ] Unit Tests
201+
- [ ] Documentation
202+
1. [ ] Class WechatyPuppet
203+
- TS SLOC(1115): <https://github.com/wechaty/wechaty-puppet/blob/master/src/puppet.ts>
204+
- [x] Code
205+
- [ ] Unit Tests
206+
- [ ] Documentation
207+
1. [ ] Class WechatyPuppetHostie
208+
- TS SLOC(909): <https://github.com/wechaty/wechaty-puppet-hostie/blob/master/src/grpc/puppet-client.ts>
209+
- [x] Code
210+
- [ ] Unit Tests
211+
- [ ] Documentation
212+
213+
## Usage
2214

3215
1. Add a token to class `io.github.wechaty.examples.Main` in folder `wechaty/src/main/java`
4216

@@ -7,7 +219,7 @@
7219
mvn install
8220
```
9221

10-
3. execute
222+
3. Run
11223
```shell
12224
java -jar wechaty/target/wechaty-1.0.0-SNAPSOHOT-jar-with-dependencies.jar
13225
```
@@ -18,4 +230,49 @@ or run in background
18230
nohup java -jar wechaty/target/wechaty-1.0.0-SNAPSOHOT-jar-with-dependencies.jar &>> nohup.out & tailf nohup.out
19231
```
20232

21-
4. enjoy
233+
4. enjoy
234+
235+
## Requirements
236+
237+
1. JDK/JRE
238+
239+
## Install
240+
241+
```shell
242+
mvn install wechaty
243+
```
244+
245+
## Links
246+
247+
1. [Publish Java Module to Maven Central Repo - OSSRH Guide](https://central.sonatype.org/pages/ossrh-guide.html)
248+
1. [Kotlin vs Java: Most Important Differences That You Must Know](https://hackr.io/blog/kotlin-vs-java)
249+
250+
## History
251+
252+
### master
253+
254+
### v0.0.1 (Mar 12, 2020)
255+
256+
1. Project created.
257+
1. First contributor joined: [@diaozxin007](https://github.com/diaozxin007) Zhengxin DIAO (刁政欣)
258+
259+
## Related Projects
260+
261+
- [Wechaty](https://github.com/wechaty/wechaty) - WeChat Bot SDK for Individual Account in TypeScript
262+
- [Python Wechaty](https://github.com/wechaty/python-wechaty) - Python WeChat Bot SDK for Individual Account.
263+
- [Go Wechaty](https://github.com/wechaty/go-wechaty) - Go WeChat Bot SDK for Individual Account.
264+
265+
## Author
266+
267+
* [Huan LI](https://github.com/huan) ([李卓桓](http://linkedin.com/in/zixia)) [email protected]
268+
269+
[![Profile of Huan LI (李卓桓) on StackOverflow](https://stackexchange.com/users/flair/265499.png)](https://stackexchange.com/users/265499)
270+
271+
* [diaozxin007](https://github.com/diaozxin007) [email protected]
272+
273+
## Copyright & License
274+
275+
- Code & Docs © 2020-now Huan LI \<[email protected]\>
276+
- Code released under the Apache-2.0 License
277+
- Docs released under Creative Commons
278+

doc/images/java-wechaty.png

44 KB
Loading

0 commit comments

Comments
 (0)