Coder Social home page Coder Social logo

openwechat's Introduction

openwechat

Go DocReleaseGo Report CardStarsForks

golang版个人微信号API, 突破网页版限制,类似开发公众号一样,开发个人微信号

微信机器人:smiling_imp:,利用微信号完成一些功能的定制化开发⭐

  • 支持定制化开发,如日志记录,自动回复
  • 突破网页版登录限制📣
  • 无需重复扫码登录
  • 支持多个微信号同时登陆

安装

go get

go get github.com/eatmoreapple/openwechat

go mod

require github.com/eatmoreapple/openwechat latest

快速开始

package main

import (
	"fmt"
	"github.com/eatmoreapple/openwechat"
)

func main() {
	bot := openwechat.DefaultBot()
  // bot := openwechat.DefaultBot(openwechat.Desktop) // 桌面模式,上面登录不上的可以尝试切换这种模式

	// 注册消息处理函数
	bot.MessageHandler = func(msg *openwechat.Message) {
		if msg.IsText() && msg.Content == "ping" {
			msg.ReplyText("pong")
		}
	}
	// 注册登陆二维码回调
	bot.UUIDCallback = openwechat.PrintlnQrcodeUrl

	// 登陆
	if err := bot.Login(); err != nil {
		fmt.Println(err)
		return
	}

	// 获取登陆的用户
	self, err := bot.GetCurrentUser()
	if err != nil {
		fmt.Println(err)
		return
	}

	// 获取所有的好友
	friends, err := self.Friends()
	fmt.Println(friends, err)

	// 获取所有的群组
	groups, err := self.Groups()
	fmt.Println(groups, err)

	// 阻塞主goroutine, 直到发生异常或者用户主动退出
	bot.Block()
}

支持功能

  • 消息回复、给指定对象(好友、群组)发送文本、图片、文件、emoji表情等消息
  • 热登陆(无需重复扫码登录)、自定义消息处理、文件下载、消息防撤回
  • 获取对象信息、设置好友备注、拉好友进群等
  • 更多功能请查看文档

文档

点击查看

项目主页

https://github.com/eatmoreapple/openwechat

Thanks

JetBrains

添加微信(EatMoreApple):apple:(备注: openwechat),进群交流:smiling_imp:

如果二维码图片没显示出来,请添加微信号 EatMoreApple

openwechat's People

Contributors

blogbin avatar eatmoreapple avatar gdmec07150942 avatar ivy-fish avatar ivy8253948 avatar li-xunhuan avatar lixh00 avatar miiw avatar onism68 avatar sml2h3 avatar suntong avatar suyu7777 avatar tossp avatar xiaobinqt avatar zangwill 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.