add wechat env 🚀
This commit is contained in:
parent
130392868e
commit
4faf5f28dc
@ -2,6 +2,7 @@ FROM golang:1.19-alpine
|
|||||||
|
|
||||||
ENV apiKey=""
|
ENV apiKey=""
|
||||||
ENV telegram=""
|
ENV telegram=""
|
||||||
|
ENV wechat=""
|
||||||
|
|
||||||
RUN export GOPRIVATE=github.com/houko/wechatgpt
|
RUN export GOPRIVATE=github.com/houko/wechatgpt
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/wechatgpt/wechatbot/config"
|
"github.com/wechatgpt/wechatbot/config"
|
||||||
"github.com/wechatgpt/wechatbot/openai"
|
"github.com/wechatgpt/wechatbot/openai"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,10 +32,12 @@ func (gmh *GroupMessageHandler) ReplyText(msg *openwechat.Message) error {
|
|||||||
group := openwechat.Group{User: sender}
|
group := openwechat.Group{User: sender}
|
||||||
log.Printf("Received Group %v Text Msg : %v", group.NickName, msg.Content)
|
log.Printf("Received Group %v Text Msg : %v", group.NickName, msg.Content)
|
||||||
|
|
||||||
keyword := "chatgpt"
|
keyword := os.Getenv("wechat")
|
||||||
appConfig := config.GetConfig()
|
if len(keyword) == 0 {
|
||||||
if appConfig != nil {
|
appConfig := config.GetConfig()
|
||||||
keyword = appConfig.ChatGpt.Keyword
|
if appConfig != nil {
|
||||||
|
keyword = appConfig.ChatGpt.Keyword
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.Contains(msg.Content, keyword) {
|
if !strings.Contains(msg.Content, keyword) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user