GithubHelp home page GithubHelp logo

su-chang / go-wechaty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wechaty/go-wechaty

0.0 1.0 0.0 702 KB

Go Wechaty is a Conversational SDK for Chatbot Makers Written in Go

Home Page: https://github.com/wechaty/go-wechaty-getting-started

License: Apache License 2.0

Go 99.43% Makefile 0.57%

go-wechaty's Introduction

go-wechaty

Go Version Go Maintainability

Go Wechaty

Go Wechaty Getting Started Wechaty in Go

Connecting Chatbots

Powered by Wechaty

Wechaty is a RPA SDK for Wechat Individual Account that can help you create a chatbot in 6 lines of Go.

Voice of the Developers

"Wechaty is a great solution, I believe there would be much more users recognize it." link
— @Gcaufy, Tencent Engineer, Author of WePY

"太好用,好用的想哭"
— @xinbenlv, Google Engineer, Founder of HaoShiYou.org

"最好的微信开发库" link
— @Jarvis, Baidu Engineer

"Wechaty让运营人员更多的时间思考如何进行活动策划、留存用户,商业变现" link
— @lijiarui, Founder & CEO of Juzi.BOT.

"If you know js ... try Wechaty, it's easy to use."
— @Urinx Uri Lee, Author of WeixinBot(Python)

See more at Wiki:Voice Of Developer

Join Us

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 go wechaty, join our Wechaty Go Developers' Home.

Wechaty Friday.BOT QR Code

Scan now, because other Wechaty Go developers want to talk with you too! (secret code: go wechaty)

The World's Shortest Go ChatBot: 7 lines of Code

package main

import (
	"fmt"

	"github.com/wechaty/go-wechaty/wechaty"
)

func main() {
	_ = wechaty.NewWechaty().
		OnScan(func(qrCode, status string) {
			fmt.Printf("Scan QR Code to login: %s\nhttps://wechaty.github.io/qrcode/%s\n", status, qrCode)
		}).
		OnLogin(func(user string) { fmt.Printf("User %s logined\n", user) }).
		OnMessage(func(message string) { fmt.Printf("Message: %s\n", message) }).
		Start()
}

Go Wechaty Developing Plan

We already have Wechaty in TypeScript, It will be not too hard to translate the TypeScript(TS) to Go because wechaty has only 3,000 lines of the TS code, they are well designed and de-coupled by the wechaty-puppet abstraction. So after we have translated those 3,000 lines of TypeScript code, we will almost be done.

As we have already a ecosystem of Wechaty in TypeScript, so we will not have to implement everything in Go, especially, in the Feb 2020, we have finished the @chatie/grpc service abstracting module with the wechaty-puppet-hostie implmentation.

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 (Go).

  +--------------------------+ +--------------------------+
  |                          | |                          |
  |   Wechaty (TypeScript)   | |      Wechaty (Go)        |
  |                          | |                          |
  +--------------------------+ +--------------------------+

  +-------------------------------------------------------+
  |                 Wechaty Puppet Hostie                 |
  |                                                       |
  |                (wechaty-puppet-hostie)                |
  +-------------------------------------------------------+

+---------------------  @chatie/grpc  ----------------------+

  +-------------------------------------------------------+
  |                Wechaty Puppet Abstract                |
  |                                                       |
  |                   (wechaty-puppet)                    |
  +-------------------------------------------------------+

  +--------------------------+ +--------------------------+
  |      Pad Protocol        | |      Web Protocol        |
  |                          | |                          |
  | wechaty-puppet-padplus   | |(wechaty-puppet-puppeteer)|
  +--------------------------+ +--------------------------+
  +--------------------------+ +--------------------------+
  |    Windows Protocol      | |       Mac Protocol       |
  |                          | |                          |
  | (wechaty-puppet-windows) | | (wechaty-puppet-macpro)  |
  +--------------------------+ +--------------------------+

Example: How to Translate TypeScript to Go

There's a 100 lines class named Image in charge of downloading the WeChat image to different sizes.

It is a great example for demonstrating how do we translate the TypeScript to Go in Wechaty Way:

Image Class Source Code

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 Go at the same time.

To-do List

  • TS: TypeScript
  • SLOC: Source Lines Of Code

Wechaty Internal Modules

  1. Class Wechaty
  2. Class Contact
  3. Class ContactSelf
  4. Class Message
  5. Class Room
  6. Class Image
  7. Class Accessory
  8. Class Config
  9. Class Favorite
  10. Class Friendship
  11. Class MiniProgram
  12. Class RoomInvitation
  13. Class Tag
  14. Class UrlLink

Wechaty External Modules

  1. Class FileBox
  2. Class MemoryCard
  3. Class WechatyPuppet
  4. Class WechatyPuppetHostie

Usage

WIP...

Requirements

  1. Go 1.14+

Install

# go get wechaty

go get github.com/wechaty/go-wechaty

Development

make install
make test

See Also

Golang for Node.js Developer

History

master

v0.4 (Jun 19, 2020)

Go Wechaty Scala Wechaty BETA Released!

Read more from our Multi-language Wechaty Beta Release event from our blog:

v0.1 (Apr 03 2020)

  1. Welcome our second and third Go Wechaty contributors:
  2. Enable GitHub Actions
    1. Enable linting: golint
    2. Enable testing: testing
  3. Add Makefile for easy developing
  4. Re-structure module directories: from src/wechaty to wechaty
  5. Rename example bot to examples/ding-dong-bot.go

v0.0.1 (Mar 12, 2020)

  1. Project created.
  2. Welcome our first Go Wechaty contributor:

Related Projects

  • Wechaty - Conversatioanl AI Chatot SDK for Wechaty Individual Accounts (TypeScript)
  • Python Wechaty - Python WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Python)
  • Go Wechaty - Go WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Go)
  • Java Wechaty - Java WeChaty Conversational AI Chatbot SDK for Wechat Individual Accounts (Java)
  • Scala Wechaty - Scala WeChaty Conversational AI Chatbot SDK for WechatyIndividual Accounts (Scala)

Badge

Wechaty in Go

[![Wechaty in Go](https://img.shields.io/badge/Wechaty-Go-7de)](https://github.com/wechaty/go-wechaty)

Contributors

contributor contributor contributor contributor contributor contributor contributor contributor

  1. @SilkageNet - Bojie LI (李博杰)
  2. @huan - Huan LI (李卓桓)

Creators

Copyright & License

  • Code & Docs © 2020 Wechaty Contributors https://github.com/wechaty
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

Thanks

goland.png

go-wechaty's People

Contributors

dchaofei avatar dingdayu avatar finctive avatar huan avatar nebell avatar silkagenet avatar simpleapples avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.