Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lz1998 committed Jul 23, 2021
1 parent 8a8aa21 commit c0a8197
Show file tree
Hide file tree
Showing 26 changed files with 45 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ _testmain.go
device.json
Go-Mirai-Client
device-*.json
static/static
pkg/static/static
gmc-*.zip
captcha.jpg
/video
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ WORKDIR /build

COPY ./ .

COPY --from=ui_builder /build/pbbot-react-ui/build ./static/static
COPY --from=ui_builder /build/pbbot-react-ui/build ./pkg/static/static

RUN cd /build \
&& go build -ldflags "-s -w -extldflags '-static'" -o gmc
&& go build -ldflags "-s -w -extldflags '-static'" -o gmc ./service/gmc

FROM alpine:latest

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ for PLATFORM in $PLATFORMS; do
GOARCH=${PLATFORM#*/}
BIN_FILENAME="${OUTPUT_DIR}/${NAME}-${GOOS}-${GOARCH}"
if [[ "${GOOS}" == "windows" ]]; then BIN_FILENAME="${BIN_FILENAME}.exe"; fi
CMD="GOOS=${GOOS} GOARCH=${GOARCH} go build -v -ldflags \"-s -w -extldflags '-static'\" -o ${BIN_FILENAME}"
CMD="GOOS=${GOOS} GOARCH=${GOARCH} go build -v -ldflags \"-s -w -extldflags '-static'\" -o ${BIN_FILENAME} github.com/ProtobufBot/Go-Mirai-Client/service/gmc"
echo $CMD
eval $CMD || FAILURES="${FAILURES} ${PLATFORM}"
done
Expand Down
4 changes: 2 additions & 2 deletions service/bot/api_handler.go → pkg/bot/api_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
_ "unsafe"


"github.com/ProtobufBot/Go-Mirai-Client/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/cache"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/clz"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/onebot"
"github.com/ProtobufBot/Go-Mirai-Client/service/cache"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion service/bot/captcha.go → pkg/bot/captcha.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/ProtobufBot/Go-Mirai-Client/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/dto"

Expand Down
5 changes: 3 additions & 2 deletions service/bot/mirai2proto.go → pkg/bot/mirai2proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package bot
import (
"strconv"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/clz"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/onebot"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
)

func MiraiMsgToProtoMsg(cli *client.QQClient, messageChain []message.IMessageElement) []*onebot.Message {
Expand Down
3 changes: 2 additions & 1 deletion service/bot/mirai2raw.go → pkg/bot/mirai2raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"html"

"github.com/ProtobufBot/Go-Mirai-Client/pkg/clz"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/clz"
)

func MiraiMsgToRawMsg(cli *client.QQClient, messageChain []message.IMessageElement) string {
Expand Down
7 changes: 4 additions & 3 deletions service/bot/proto2mirai.go → pkg/bot/proto2mirai.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"strings"
"time"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/cache"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/clz"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/onebot"
"github.com/ProtobufBot/Go-Mirai-Client/service/cache"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
log "github.com/sirupsen/logrus"
)

Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions service/bot/remote.go → pkg/bot/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"strconv"
"time"

"github.com/Mrs4s/MiraiGo/client"
"github.com/ProtobufBot/Go-Mirai-Client/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/safe_ws"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/onebot"

"github.com/Mrs4s/MiraiGo/client"
"github.com/golang/protobuf/proto"
"github.com/gorilla/websocket"
log "github.com/sirupsen/logrus"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"time"

"github.com/ProtobufBot/Go-Mirai-Client/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"

"github.com/Mrs4s/MiraiGo/binary"
Expand Down
10 changes: 5 additions & 5 deletions main.go → pkg/gmc/gmc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package gmc

import (
"flag"
Expand All @@ -10,10 +10,10 @@ import (
"strconv"
"strings"

"github.com/ProtobufBot/Go-Mirai-Client/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/gmc/handler"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/static"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
"github.com/ProtobufBot/Go-Mirai-Client/service/handler"
"github.com/ProtobufBot/Go-Mirai-Client/static"

"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -50,7 +50,7 @@ func init() {
log.SetOutput(os.Stdout)
}

func main() {
func Start() {
if help {
flag.Usage()
os.Exit(0)
Expand Down
4 changes: 2 additions & 2 deletions service/handler/bot.go → pkg/gmc/handler/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"sync"
"time"

"github.com/ProtobufBot/Go-Mirai-Client/pkg/bot"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/device"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/gmc/plugins"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/util"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/dto"
"github.com/ProtobufBot/Go-Mirai-Client/service/bot"
"github.com/ProtobufBot/Go-Mirai-Client/service/plugins"

"github.com/Mrs4s/MiraiGo/client"
"github.com/gin-gonic/gin"
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions service/plugins/hello.go → pkg/gmc/plugins/hello.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package plugins

import (
"github.com/ProtobufBot/Go-Mirai-Client/pkg/bot"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"
"github.com/ProtobufBot/Go-Mirai-Client/service/bot"
)

func HelloPrivateMessage(cli *client.QQClient, event *message.PrivateMessage) int32 {
Expand Down
5 changes: 3 additions & 2 deletions service/plugins/log.go → pkg/gmc/plugins/log.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package plugins

import (
"github.com/ProtobufBot/Go-Mirai-Client/pkg/bot"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"
"github.com/ProtobufBot/Go-Mirai-Client/service/bot"
log "github.com/sirupsen/logrus"
)

Expand Down
9 changes: 5 additions & 4 deletions service/plugins/report.go → pkg/gmc/plugins/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"strconv"
"time"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/bot"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/cache"
"github.com/ProtobufBot/Go-Mirai-Client/pkg/plugin"
"github.com/ProtobufBot/Go-Mirai-Client/proto_gen/onebot"
"github.com/ProtobufBot/Go-Mirai-Client/service/bot"
"github.com/ProtobufBot/Go-Mirai-Client/service/cache"

"github.com/Mrs4s/MiraiGo/client"
"github.com/Mrs4s/MiraiGo/message"
log "github.com/sirupsen/logrus"
)

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions service/gmc/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/ProtobufBot/Go-Mirai-Client/pkg/gmc"

func main() {
gmc.Start()
}

0 comments on commit c0a8197

Please sign in to comment.