v2.7 🚀
This commit is contained in:
parent
905354f9f6
commit
64462d2313
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
token.json
|
||||
local/config.yaml
|
@ -1,8 +1,6 @@
|
||||
FROM golang:1.19-alpine
|
||||
|
||||
ENV apiKey=""
|
||||
ENV telegram=""
|
||||
ENV wechat=""
|
||||
|
||||
RUN export GOPRIVATE=github.com/houko/wechatgpt
|
||||
|
||||
|
26
README.md
26
README.md
@ -44,9 +44,9 @@ go run main.go
|
||||
```
|
||||
|
||||
## `Docker` 方式运行`wechatgpt`
|
||||
`建议单独跑多个docker以免互相影响`
|
||||
|
||||
同时启动微信和telegram,微信登陆的地址请查看运行日志
|
||||
|
||||
```
|
||||
# apple silicon
|
||||
docker run -d \
|
||||
@ -104,6 +104,30 @@ xiaomoinfo/wechatgpt-amd64:latest
|
||||
|
||||
```
|
||||
|
||||
|
||||
如果运行`telegram`智能机器人时只希望指定的人使用,白名单以外的人发消息机器人不会回复
|
||||
|
||||
```
|
||||
# apple silicon
|
||||
docker run -d \
|
||||
--name wechatgpt \
|
||||
-e apiKey="你的chatgpt apiKey" \
|
||||
-e telegram="你的telegram token" \
|
||||
-e tg_whitelist="username1,username2" \
|
||||
xiaomoinfo/wechatgpt:latest
|
||||
|
||||
# linux amd64
|
||||
docker run -d \
|
||||
--name wechatgpt \
|
||||
-e apiKey="你的chatgpt apiKey" \
|
||||
-e telegram="你的telegram token" \
|
||||
-e tg_whitelist="username1,username2" \
|
||||
xiaomoinfo/wechatgpt-amd64:latest
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
<img src="screenshots/docker部署.png" alt="drawing" style="width:450px;"/>
|
||||
|
||||
### 微信
|
||||
|
@ -12,14 +12,16 @@ tasks:
|
||||
|
||||
release:
|
||||
cmds:
|
||||
- docker rmi xiaomoinfo/wechatgpt-amd64:latest
|
||||
- docker build --platform linux/amd64 -t xiaomoinfo/wechatgpt-amd64:latest .
|
||||
- docker push xiaomoinfo/wechatgpt-amd64:latest
|
||||
- docker rmi xiaomoinfo/wechatgpt:latest
|
||||
- docker build -t xiaomoinfo/wechatgpt:latest .
|
||||
- docker push xiaomoinfo/wechatgpt:latest
|
||||
|
||||
2.4:
|
||||
version:
|
||||
cmds:
|
||||
- docker build --platform linux/amd64 -t xiaomoinfo/wechatgpt-amd64:2.4 .
|
||||
- docker push xiaomoinfo/wechatgpt-amd64:2.4
|
||||
- docker build -t xiaomoinfo/wechatgpt:2.4 .
|
||||
- docker push xiaomoinfo/wechatgpt:2.4
|
||||
- docker build --platform linux/amd64 -t xiaomoinfo/wechatgpt-amd64:2.6 .
|
||||
- docker push xiaomoinfo/wechatgpt-amd64:2.6
|
||||
- docker build -t xiaomoinfo/wechatgpt:2.6 .
|
||||
- docker push xiaomoinfo/wechatgpt:2.6
|
@ -7,6 +7,7 @@ import (
|
||||
"github.com/wechatgpt/wechatbot/config"
|
||||
"github.com/wechatgpt/wechatbot/handler/telegram"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -47,6 +48,27 @@ func StartTelegramBot() {
|
||||
}
|
||||
text := update.Message.Text
|
||||
chatID := update.Message.Chat.ID
|
||||
chatUserName := update.Message.Chat.UserName
|
||||
|
||||
tgUserNameStr := os.Getenv("tg_whitelist")
|
||||
|
||||
tgUserNames := strings.Split(tgUserNameStr, ",")
|
||||
|
||||
if len(tgUserNames) > 0 {
|
||||
found := false
|
||||
for _, name := range tgUserNames {
|
||||
if name == chatUserName {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
log.Error("用户设置了私人私用,白名单以外的人不生效: ", chatUserName)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
responseMsg := telegram.Handle(text)
|
||||
if responseMsg == nil {
|
||||
continue
|
||||
|
Loading…
x
Reference in New Issue
Block a user