一個還算有意思的wechat robot項目,理想將其設計成一個多功能的機器人助手?
Dean DLL 、千寻框架vlw框架,請參考framework目錄plugins目錄下的功能,請參考plugins目錄? 注意:
微信的hook類軟件,那麼只需要在這類軟件上設置回調地址即可Dean DLL 、千寻vlw三個框架,如果您有其他框架,可自行添加(參考framework目錄,實現IFramework接口即可),或聯繫我添加hook類軟件,您需要利用搜索引擎自行尋找功能示例:

config.yaml文件註釋說明
config.yaml文件註釋說明
// IFramework 这是接入框架所定义的接口
type IFramework interface {
// Callback 这是消息回调方法,vx框架回调消息转发给该Server
Callback ( func ( * Event , IFramework ))
// GetMemePictures 获取表情包图片地址(迷因图)
// return: 图片链接(网络URL或图片base64)
GetMemePictures ( message * Message ) string
// SendText 发送文本消息
// toWxId: 好友ID/群ID
// text: 文本内容
SendText ( toWxId , text string ) error
// SendTextAndAt 发送文本消息并@,只有群聊有效
// toGroupWxId: 群ID
// toWxId: 好友ID/群ID/all
// toWxName: 好友昵称/群昵称,留空为自动获取
// text: 文本内容
SendTextAndAt ( toGroupWxId , toWxId , toWxName , text string ) error
// SendImage 发送图片消息
// toWxId: 好友ID/群ID
// path: 图片路径
SendImage ( toWxId , path string ) error
// SendShareLink 发送分享链接消息
// toWxId: 好友ID/群ID
// title: 标题
// desc: 描述
// imageUrl: 图片链接
// jumpUrl: 跳转链接
SendShareLink ( toWxId , title , desc , imageUrl , jumpUrl string ) error
// SendFile 发送文件消息
// toWxId: 好友ID/群ID/公众号ID
// path: 本地文件绝对路径
SendFile ( toWxId , path string ) error
// SendVideo 发送视频消息
// toWxId: 好友ID/群ID/公众号ID
// path: 本地视频文件绝对路径
SendVideo ( toWxId , path string ) error
// SendEmoji 发送表情消息
// toWxId: 好友ID/群ID/公众号ID
// path: 本地动态表情文件绝对路径
SendEmoji ( toWxId , path string ) error
// SendMusic 发送音乐消息
// toWxId: 好友ID/群ID/公众号ID
// name: 音乐名称
// author: 音乐作者
// app: 音乐来源(VLW需留空),酷狗/wx79f2c4418704b4f8,网易云/wx8dd6ecd81906fd84,QQ音乐/wx5aa333606550dfd5
// jumpUrl: 音乐跳转链接
// musicUrl: 网络歌曲直链
// coverUrl: 封面图片链接
SendMusic ( toWxId , name , author , app , jumpUrl , musicUrl , coverUrl string ) error
// SendMiniProgram 发送小程序消息
// toWxId: 好友ID/群ID/公众号ID
// ghId: 小程序ID
// title: 标题
// content: 内容
// imagePath: 图片路径, 本地图片路径或网络图片URL
// jumpPath: 小程序点击跳转地址,例如:pages/index/index.html
SendMiniProgram ( toWxId , ghId , title , content , imagePath , jumpPath string ) error
// SendMessageRecord 发送消息记录
// toWxId: 好友ID/群ID/公众号ID
// title: 仅供电脑上显示用,手机上的话微信会根据[显示昵称]来自动生成 谁和谁的聊天记录
// dataList:
// - wxid: 发送此条消息的人的wxid
// - nickName: 显示的昵称(可随意伪造)
// - timestamp: 10位时间戳
// - msg: 消息内容
SendMessageRecord ( toWxId , title string , dataList [] map [ string ] interface {}) error
// SendMessageRecordXML 发送消息记录(XML方式)
// toWxId: 好友ID/群ID/公众号ID
// xmlStr: 消息记录XML代码
SendMessageRecordXML ( toWxId , xmlStr string ) error
// SendFavorites 发送收藏消息
// toWxId: 好友ID/群ID/公众号ID
// favoritesId: 收藏夹ID
SendFavorites ( toWxId , favoritesId string ) error
// SendXML 发送XML消息
// toWxId: 好友ID/群ID/公众号ID
// xmlStr: XML代码
SendXML ( toWxId , xmlStr string ) error
// SendBusinessCard 发送名片消息
// toWxId: 好友ID/群ID/公众号ID
// targetWxId: 目标用户ID
SendBusinessCard ( toWxId , targetWxId string ) error
// AgreeFriendVerify 同意好友验证
// v3: 验证V3
// v4: 验证V4
// scene: 验证场景
AgreeFriendVerify ( v3 , v4 , scene string ) error
// InviteIntoGroup 邀请好友加入群组
// groupWxId: 群ID
// wxId: 好友ID
// typ: 邀请类型,1-直接拉,2-发送邀请链接
InviteIntoGroup ( groupWxId , wxId string , typ int ) error
// GetObjectInfo 获取对象信息
// wxId: 好友ID/群ID/公众号ID
// return: User, error
GetObjectInfo ( wxId string ) ( * User , error )
// GetFriends 获取好友列表
// isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存
// return: []*User, error
GetFriends ( isRefresh bool ) ([] * User , error )
// GetGroups 获取群组列表
// isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存
// return: []*User, error
GetGroups ( isRefresh bool ) ([] * User , error )
// GetGroupMembers 获取群成员列表
// groupWxId: 群ID
// isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存
// return: []*User, error
GetGroupMembers ( groupWxId string , isRefresh bool ) ([] * User , error )
// GetMPs 获取公众号订阅列表
// isRefresh: 是否刷新 false-从缓存中获取,true-重新遍历二叉树并刷新缓存
// return: []*User, error
GetMPs ( isRefresh bool ) ([] * User , error )
}import _ "github.com/yqchilde/wxbot/plugins/baidubaike"import _ "github.com/yqchilde/wxbot/plugins/chatgpt"import _ "github.com/yqchilde/wxbot/plugins/crazykfc"import _ "github.com/yqchilde/wxbot/plugins/memepicture"import _ "github.com/yqchilde/wxbot/plugins/moyuban"import _ "github.com/yqchilde/wxbot/plugins/pinyinsuoxie"import _ "github.com/yqchilde/wxbot/plugins/plmm"import _ "github.com/yqchilde/wxbot/plugins/weather"import _ "github.com/yqchilde/wxbot/plugins/zaobao"import _ "github.com/yqchilde/wxbot/plugins/manager"import _ "github.com/yqchilde/wxbot/plugins/ghmonitor"import _ "github.com/yqchilde/wxbot/plugins/wordcloud"import _ "github.com/yqchilde/wxbot/plugins/chaid"import _ "github.com/yqchilde/wxbot/plugins/youdaofanyi"import _ "github.com/yqchilde/wxbot/plugins/friendadd"import _ "github.com/yqchilde/wxbot/plugins/choose"import _ "github.com/yqchilde/wxbot/plugins/localimage"import _ "github.com/yqchilde/wxbot/plugins/localimagespider"點擊查看機器人有哪些指令
git clone https://github.com/yqchilde/wxbot.git配置config.yaml
調試運行或編譯
go run main.gomake releasebash -c " $( curl -fsSL https://raw.fastgit.org/yqchilde/wxbot/hook/docker/run.sh ) "config.yaml ,否則會報錯docker run -d
--name= " wxbot "
-p 9528:9528
-v $( pwd ) /config.yaml:/app/config.yaml
-v $( pwd ) /data:/app/data
yqchilde/wxbot:latestfork本項目WXBOT_TOKEN ,值為上面獲取的tokenv1.0.0 ,然後等待actions編譯完成,編譯完成後會在release中生成對應的wxbot文件?如果您想要擴展自己的插件,可以參考plugins目錄下的插件
?如果您想要擴展其他框架,可以參考frameworks目錄下的框架
?如果您需要增減插件,可編輯plugins.yaml 中代碼中去掉對應插件的導入或者添加對應插件的導入,照貓畫虎即可
?修改完plugins.yaml後需要執行一次make plugins或go generate -tags plugins ./engine/plugins生成對應的plugins.go文件再去編譯
- " github.com/yqchilde/wxbot/plugins/baidubaike " # 百度百科
- " github.com/yqchilde/wxbot/plugins/chatgpt " # GPT聊天
- " github.com/yqchilde/wxbot/plugins/crazykfc " # 肯德基疯狂星期四骚话
- " github.com/yqchilde/wxbot/plugins/ghmonitor " # 公众号消息监控转发
- " github.com/yqchilde/wxbot/plugins/manager " # 群组管理相关
- " github.com/yqchilde/wxbot/plugins/memepicture " # 表情包原图
- " github.com/yqchilde/wxbot/plugins/moyuban " # 摸鱼办
- " github.com/yqchilde/wxbot/plugins/pinyinsuoxie " # 拼音缩写翻译
- " github.com/yqchilde/wxbot/plugins/plmm " # 漂亮妹妹
- " github.com/yqchilde/wxbot/plugins/weather " # 天气查询
- " github.com/yqchilde/wxbot/plugins/zaobao " # 每日早报
- " github.com/yqchilde/wxbot/plugins/wordcloud " # 聊天热词
- " github.com/yqchilde/wxbot/plugins/chaid " # 查wxId
- " github.com/yqchilde/wxbot/plugins/youdaofanyi " # 有道翻译查看更多使用案例
| 環境變量名 | 變量類型 | 說明 |
|---|---|---|
| DEBUG | bool | 優先級大於其他DEBUG_開頭的變量,開啟後開啟所有DEBUG模式用於調試HTTP請求和調用日誌文件名和行號 |
| DEBUG_LOG | bool | 用於調試調用日誌文件名和行號 |
import (
"errors"
"fmt"
"strings"
"sync"
"time"
"github.com/PullRequestInc/go-gpt3"
"github.com/yqchilde/wxbot/engine/control"
"github.com/yqchilde/wxbot/engine/pkg/log"
"github.com/yqchilde/wxbot/engine/pkg/sqlite"
"github.com/yqchilde/wxbot/engine/robot"
)插件,請在plugins.yaml中添加對應的插件插件,請在README.md中已有插件部分添加對應的插件插件,請在plugins/README.md中添加對應的插件make plugins或go generate -tags plugins ./engine/plugins生成對應的plugins.go文件開發計劃: 開發計劃如果您感覺這個項目有意思,麻煩幫我點一下star
這個項目待(不)補(完)充(善)很多東西,由於工作關係會抽出時間弄,感謝您發現並使用此倉庫
如果您有疑惑可以加Q群討論

yqchilde/wxbot項目一直以來都是在JetBrains 公司旗下的GoLand 集成開發環境中進行開發,基於free JetBrains Open Source license(s)正版免費授權,在此表達我的謝意。
非Hook版機器人核心由openwechat SDK實現,在nohook分支,已暫停維護
Hook版機器人框架我使用的是《我的框架》已跑路,現在用的是千尋,Dean DLL,為hook分支
hook分支大量借鑒了一個十分優秀的項目ZeroBot-Plugin的設計方案??,其中很多基礎代碼來自ZeroBot-Plugin ,在此基礎上擴展了支持wechat的方式,非常感謝,Thanks♪(・ω・)ノ
AGPL-3.0 license. See the LICENSE file for details.