Un projet de robot WeChat assez intéressant, idéal pour le concevoir en tant qu'assistant de robot multifonctionnel?
Dean DLL ,千寻框架vlw框架, veuillez vous référer au répertoire frameworkplugins Les fonctions peuvent plugins étendues sans intrusion.? Avis:
微信的hook pertinent, vous n'avez donc qu'à définir l'adresse de rappel sur ce type de logiciel.Dean DLL ,千寻IFramework vlw frameworkhook , vous devez utiliser les moteurs de recherche pour le trouver vous-mêmeExemple fonctionnel:

config.yaml pour une configuration spécifique 
config.yaml pour une configuration spécifique 
// 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"Cliquez pour voir quelles instructions sont disponibles pour le robot
git clone https://github.com/yqchilde/wxbot.git Configurer config.yaml
Débogage de course ou de compilation
go run main.gomake releasebash -c " $( curl -fsSL https://raw.fastgit.org/yqchilde/wxbot/hook/docker/run.sh ) "config.yaml à l'avance, sinon une erreur sera signalée. docker run -d
--name= " wxbot "
-p 9528:9528
-v $( pwd ) /config.yaml:/app/config.yaml
-v $( pwd ) /data:/app/data
yqchilde/wxbot:latestfork ce projet en premierWXBOT_TOKEN , et la valeur est le jeton obtenu ci-dessuswxbot release , comme v1.0.0 , puis attendez que les actions soient compilées. ? Si vous souhaitez étendre votre propre plugin, vous pouvez vous référer aux plugins dans le répertoire plugins
? Si vous souhaitez étendre d'autres frameworks, vous pouvez vous référer aux frameworks du répertoire frameworks
? Si vous avez besoin d'ajouter ou de supprimer les plugins, vous pouvez modifier le code dans les plugins.yaml pour supprimer l'importation des plugins correspondants ou ajouter l'importation des plugins correspondants et dessiner simplement l'image.
? Après avoir modifié plugins.yaml , vous devez exécuter make plugins ou go generate -tags plugins ./engine/plugins pour générer le fichier plugins.go correspondant avant la compilation
- " 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 " # 有道翻译Voir plus de cas d'utilisation
| Nom de la variable d'environnement | Type variable | illustrer |
|---|---|---|
| DÉBOGUER | bool | La priorité est supérieure aux autres variables commençant par DEBUG_ . |
| Debug_log | bool | Utilisé pour déboguer le nom du fichier journal des appels et le numéro de ligne |
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"
)插件, veuillez ajouter le plugin correspondant dans plugins.yaml插件, veuillez ajouter le plug-in correspondant à la section plug-in existante dans README.md插件, veuillez ajouter le plugin correspondant dans plugins/README.mdmake plugins ou go generate -tags plugins ./engine/plugins pour générer d'abord le fichier plugins.go correspondant. Plan de développement: plan de développement Si vous trouvez ce projet intéressant, veuillez cliquer sur l'étoile
Ce projet sera reconstitué et reconstitué beaucoup de choses.
Si vous avez des questions, vous pouvez rejoindre le groupe Q pour discuter

yqchilde/wxbot a toujours été développé dans l'environnement de développement intégré Goland sous JetBrains.
La version non hook du noyau du robot est implémentée par le SDK OpenWechat, et la maintenance a été suspendue dans nohook .
J'utilise la version Hook de Robot Framework Mon cadre s'est enfui , utilisez maintenant Qianxun , Dean Dll, pour la branche de crochet
La branche de crochet a beaucoup emprunté au schéma de conception d' wechat très excellent projet ZeroBot-Plugin ZeroBot-Plugin
Licence AGPL-3.0.