-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
web 协议 总是 提示断线 #107
Comments
Dockerexport WECHATY_TOKEN="$(python3 -c 'import uuid;print(uuid.uuid4())')"
export tag=$2
export WECHATY_LOG=$3
export WECHATY_PUPPET=$4
export WECHATY_PUPPET_SERVER_PORT=$5
export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT=true
export WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER=true
docker run -ti --rm \
--name wechatBot \
-e WECHATY_TOKEN \
-e WECHATY_LOG \
-e WECHATY_PUPPET \
-e WECHATY_PUPPET_SERVER_PORT \
-e WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT \
-e WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER \
-p "${WECHATY_PUPPET_SERVER_PORT}:${WECHATY_PUPPET_SERVER_PORT}" \
-v "$(pwd)/Gateway:/bot" \
wechaty/wechaty:"$tag" Golang var bot = wechaty.NewWechaty(wechaty.WithPuppetOption(wp.Option{
Token: "0f27d692-15bc-4b2e-aea3-956c5f18cae8"
Timeout: 5 * time.Minute,
}),
)
bot.OnScan(func(ctx *wechaty.Context, qrCode string, status schemas.ScanStatus, data string) {
fmt.Printf("Scan QR Code to login: %v\nhttps://wechaty.github.io/qrcode/%s\n", status, qrCode)
}).OnLogin(func(ctx *wechaty.Context, user *user.ContactSelf) {
fmt.Printf("User %s logined\n", user.Name())
}).OnMessage(onMessage).OnLogout(func(ctx *wechaty.Context, user *user.ContactSelf, reason string) {
fmt.Printf("User %s logouted: %s\n", user, reason)
})
bot.DaemonStart() log
|
首先确认你的docker版本,不能大于0.68,否则无法使用,这个一般都是属于docker或版本不匹配导致获取不到服务器。 Disable TLS for Puppet Service Server Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER to true Set WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT to true 如果大于0.68的docker你就会涉及到这个问题,但不排除会有意外的BUG,所以使用go版的,推荐版本不要大于0.68. 目前测试稳定版本对接docker建议版本为0.65. |
@windmemory 是的,使用的是v0.65 tag 给的值就是 0.65 |
如果连接不上,记得外网端口映射。否则GRPC无法和你的服务器对接,也会导致这个情况。 |
谢谢,我ncat 测试过了 |
不过有个问题也是我感觉非常恶心的事情,某些参数已经export了,每次都要设置,程序运行之后,都会自动删除,非常恶心。 |
哈哈哈,我之前用python的时候看到一个好东西,当然我的仓库也愿意于你分享!但是写的不完善,就没开放 makefile WECHATY_LOG = verbose
WECHATY_PUPPET = wechaty-puppet-wechat
WECHATY_PUPPET_SERVER_PORT = 30000
WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER = true
WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT = true
v = 0.65
.PHONY: all
all:
@$(PWD)/.github/Makefile.sh all ${v} ${WECHATY_LOG} ${WECHATY_PUPPET} ${WECHATY_PUPPET_SERVER_PORT} ${WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER} ${WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT}
# wechaty/wechaty mybot.ts
.PHONY: updateToken
updateToken:
@$(PWD)/.github/Makefile.sh updateToken
.PHONY: server
server:
@cd Server;go run main.go
.PHONY: build
build:
@cd Server;go mod download;go mod tidy bash #!/usr/bin/env bash
export WECHATY_TOKEN="$(python3 -c 'import uuid;print(uuid.uuid4())')"
export tag=$2
export WECHATY_LOG=$3
export WECHATY_PUPPET=$4
export WECHATY_PUPPET_SERVER_PORT=$5
WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER=$6
WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT=$7
function all () {
initToken
docker run -ti --rm \
--name wechatBot \
-e WECHATY_TOKEN \
-e WECHATY_LOG \
-e WECHATY_PUPPET \
-e WECHATY_PUPPET_SERVER_PORT \
-e WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_SERVER \
-e WECHATY_PUPPET_SERVICE_NO_TLS_INSECURE_CLIENT \
-p "${WECHATY_PUPPET_SERVER_PORT}:${WECHATY_PUPPET_SERVER_PORT}" \
-v "$(pwd)/Gateway:/bot" \
wechaty/wechaty:"$tag"
# wechaty/wechaty mybot.ts
}
function touchToken(){
touch "$(pwd)/Gateway/${WECHATY_TOKEN}.memory-card.json" || exit
echo "WECHATY_TOKEN 创建完成! => $(pwd)/Gateway/${WECHATY_TOKEN}.memory-card.json"
echo "WECHATY_TOKEN: ${WECHATY_TOKEN}"
}
function deleteToken(){
rm -rf "$(pwd)"/Gateway/*.memory-card.json
}
function initToken(){
if [[ "$(find "$(pwd)/Gateway/" -maxdepth 1 -name '*.memory-card.json' | wc -l | tr -d ' ')" -eq 0 ]]; then
touchToken
elif [[ "$(find "$(pwd)/Gateway/" -maxdepth 1 -name '*.memory-card.json' | wc -l | tr -d ' ')" -gt 1 ]]; then
echo "Token 文件异常,正在初始化 Token ..."
deleteToken
touchToken
else
echo "Token 数量 1 个,没有问题! "
file="$(basename $(ls $(pwd)/Gateway/*.memory-card.json || exit))"
export WECHATY_TOKEN="${file%%.*}"
echo "WECHATY_TOKEN: ${WECHATY_TOKEN}"
fi
}
function updateToken() {
deleteToken
touchToken
}
$* 使用方式 |
为你点个赞! |
12:03:23 VERB MemoryCard set(PUPPET_WECHAT, [object Object],[object Object],[object Object]) 现在才发现,我映射错位置了,哈哈哈 |
@XRSec Congratulations! Would you like to share your experiences by posting them to a Wechaty community blog post at https://wechaty.js.org/blog ? Because that will make it easy to be discovered by other Go Developers. Please feel free to create a PR at https://github.com/wechaty/jekyll if you like. |
问题已解决,关闭 |
亲爱的大佬,请问一下,就现在为止,该怎么搭配 purper
wecahty4u 好几年没维护了,wechaty4u 搭配的是 docker 0.65版本
最新版的 docker 镜像登录web版微信没有问题,但是 客户端提示连接失败,是否需要添加其他的参数呢?
Python 库 试用过了,还有提示,go 库 直接丢出报错,让我这个不怎么读代码的 菜鸟来说有点难受
The text was updated successfully, but these errors were encountered: