All Projects → liangjfblue → wxBot4g

liangjfblue / wxBot4g

Licence: other
wxBot4g 是基于go的微信机器人

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to wxBot4g

easy-gin
一套基于 Gin 框架的 MVC 脚手架,使用 govendor 包管理
Stars: ✭ 74 (+155.17%)
Mutual labels:  gin
short
URL shortening service. 高性能短链接服务。
Stars: ✭ 14 (-51.72%)
Mutual labels:  gin
ginprom
Gin Prometheus metrics exporter inspired by https://github.com/zsais/go-gin-prometheus
Stars: ✭ 97 (+234.48%)
Mutual labels:  gin
covid19-kerala-api-deprecated
Deprecated - A fast API service for retrieving day to day stats about Coronavirus(COVID-19, SARS-CoV-2) outbreak in Kerala(India).
Stars: ✭ 14 (-51.72%)
Mutual labels:  gin
popcat-echo
The server-side reproduction, similar the one of https://popcat.click, improve the performance and speed.
Stars: ✭ 62 (+113.79%)
Mutual labels:  gin
ipd
查询ip地理信息,多种查询模式,高效,具有缓存机制,并可使用elasticsearch构建自己的ip数据库
Stars: ✭ 24 (-17.24%)
Mutual labels:  gin
go-realworld-example-app
Exemplary real world application built with Go, Gin, and go-pg
Stars: ✭ 48 (+65.52%)
Mutual labels:  gin
gt-crud
gin+gorm+mysql+api[两步自动crud]
Stars: ✭ 15 (-48.28%)
Mutual labels:  gin
website
Official website and document for Gin
Stars: ✭ 88 (+203.45%)
Mutual labels:  gin
gin-gorm-api-example
[Article] Minimal code for Golang based API
Stars: ✭ 98 (+237.93%)
Mutual labels:  gin
go-gin-app
Fork from https://github.com/demo-apps/go-gin-app.git
Stars: ✭ 15 (-48.28%)
Mutual labels:  gin
hpay
a personal payment applet implemented using the gin framework
Stars: ✭ 71 (+144.83%)
Mutual labels:  gin
geo-smart-system
Open Source Realtime Tracking System
Stars: ✭ 36 (+24.14%)
Mutual labels:  gin
gapp
go gin应用
Stars: ✭ 42 (+44.83%)
Mutual labels:  gin
iris-admin
Web admin for iris-go framwork
Stars: ✭ 602 (+1975.86%)
Mutual labels:  gin
blog
后端api采用go语言框架gin编写,前端使用vue + element ui编写
Stars: ✭ 45 (+55.17%)
Mutual labels:  gin
iam
企业级的 Go 语言实战项目:认证和授权系统
Stars: ✭ 1,900 (+6451.72%)
Mutual labels:  gin
golesson
go + gin + graphql
Stars: ✭ 30 (+3.45%)
Mutual labels:  gin
gin-timeout
Timeout Middleware for Gin framework
Stars: ✭ 61 (+110.34%)
Mutual labels:  gin
go2sky-plugins
The plugins of go2sky
Stars: ✭ 46 (+58.62%)
Mutual labels:  gin

wxBot4g 是基于go的微信机器人

技术

  • gin(http框架)
  • cron(定时任务)
  • etree(解析xml)
  • viper(配置文件读取)
  • logrus(日志框架)
  • go-qrcode(登陆二维码生成)

目前支持的消息类型

好友消息

  • 文本
  • 图片
  • 地理位置
  • 个人名片
  • 语音
  • 小视频
  • 动画

群消息

  • 文本
  • 图片
  • 地理位置
  • 个人名片
  • 语音
  • 动画

TODO功能

  • 提供restful api,发送消息到指定好友/群
  • 文件/图片上传阿里云oss
  • 监听指定群报警
  • 聊天记录中文分析,情感分析

使用例子

24行代码就实现微信机器人的监听消息功能

package main

import (
    "wxBot4g/models"
    "wxBot4g/pkg/define"
    "wxBot4g/wcbot"

    "github.com/sirupsen/logrus"
)

func HandleMsg(msg models.RealRecvMsg) {
    logrus.Debug("MsgType: ", msg.MsgType, " ", " MsgTypeId: ", msg.MsgTypeId)
    logrus.Info(
        "消息类型:", define.MsgIdString(msg.MsgType), " ",
        "数据类型:", define.MsgTypeIdString(msg.MsgTypeId), " ",
        "发送人:", msg.SendMsgUSer.Name, " ",
        "内容:", msg.Content.Data)
}

func main() {
    bot := wcbot.New(HandleMsg)
    bot.Debug = true
    bot.Run()
}

消息类型和数据类型

MsgType(消息类型)

数据类型编号 数据类型 说明
0 Init 初始化消息,内部数据
1 Self 自己发送的消息
2 FileHelper 文件消息
3 Group 群消息
4 Contact 联系人消息
5 Public 公众号消息
6 Special 特殊账号消息
51 获取wxid 获取wxid消息
99 Unknown 未知账号消息

MsgTypeId(数据类型)

数据类型编号 数据类型 说明
0 Text 文本消息的具体内容
1 Location 地理位置
3 Image 图片数据的url,HTTP POST请求此url可以得到jpg文件格式的数据
4 Voice 语音数据的url,HTTP POST请求此url可以得到mp3文件格式的数据
5 Recommend 包含 nickname (昵称), alias (别名),province (省份),city (城市), gender (性别)字段
6 Animation 动画url, HTTP POST请求此url可以得到gif文件格式的数据
7 Share 字典,包含 type (类型),title (标题),desc (描述),url (链接),from (源网站)字段
8 Video 视频,未支持
9 VideoCall 视频电话,未支持
10 Redraw 撤回消息
11 Empty 内容,未支持
99 Unknown 未支持

功能api

发送文本消息(好友/群)

http://127.0.0.1:7788/v1/msg/text?to=测试群&word=你好, 测试一下&appKey=khr1244o1oh

发送图片消息(好友/群)

请参考wxBot4g/wcbot/imageHandle_test.go

v1.1

  • 增加终端二维码扫码登录
  • 增加api,发送文本、图片消息到指定群
  • 增加单元测试
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].