mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
ci: update golangci-lint
fix golint update golangci-lint
This commit is contained in:
parent
3200ac2b5f
commit
ee73fca2ce
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -57,4 +57,4 @@ jobs:
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.29
|
||||
version: latest
|
||||
|
88
.golangci.yml
Normal file
88
.golangci.yml
Normal file
@ -0,0 +1,88 @@
|
||||
linters-settings:
|
||||
errcheck:
|
||||
ignore: fmt:.*,io/ioutil:^Read.*
|
||||
ignoretests: true
|
||||
|
||||
goimports:
|
||||
local-prefixes: github.com/Mrs4s/go-cqhttp
|
||||
|
||||
gocritic:
|
||||
disabled-checks:
|
||||
- exitAfterDefer
|
||||
|
||||
forbidigo:
|
||||
# Forbid the following identifiers
|
||||
forbid:
|
||||
- ^fmt\.Errorf$ # consider errors.Errorf in github.com/pkg/errors
|
||||
|
||||
linters:
|
||||
# please, do not use `enable-all`: it's deprecated and will be removed soon.
|
||||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
|
||||
disable-all: true
|
||||
fast: false
|
||||
enable:
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- depguard
|
||||
- dogsled
|
||||
- dupl
|
||||
- errcheck
|
||||
- exportloopref
|
||||
- exhaustive
|
||||
#- funlen
|
||||
#- goconst
|
||||
- gocritic
|
||||
#- gocyclo
|
||||
- gofmt
|
||||
- goimports
|
||||
- goprintffuncname
|
||||
#- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- nolintlint
|
||||
- rowserrcheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- whitespace
|
||||
- prealloc
|
||||
- predeclared
|
||||
- asciicheck
|
||||
- revive
|
||||
- forbidigo
|
||||
- makezero
|
||||
#- interfacer
|
||||
|
||||
# don't enable:
|
||||
# - scopelint
|
||||
# - gochecknoglobals
|
||||
# - gocognit
|
||||
# - godot
|
||||
# - godox
|
||||
# - goerr113
|
||||
# - interfacer
|
||||
# - maligned
|
||||
# - nestif
|
||||
# - testpackage
|
||||
# - wsl
|
||||
|
||||
run:
|
||||
# default concurrency is a available CPU number.
|
||||
# concurrency: 4 # explicitly omit this value to fully utilize available resources.
|
||||
deadline: 5m
|
||||
issues-exit-code: 1
|
||||
tests: false
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
format: 'colored-line-number'
|
||||
print-issued-lines: true
|
||||
print-linter-name: true
|
||||
uniq-by-line: true
|
21
coolq/api.go
21
coolq/api.go
@ -4,10 +4,6 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/tidwall/gjson"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
@ -19,7 +15,12 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
// Version go-cqhttp的版本信息,在编译时使用ldflags进行覆盖
|
||||
@ -438,12 +439,12 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) MSG {
|
||||
// CQSendPrivateMessage 发送私聊消息
|
||||
//
|
||||
// https://git.io/Jtz1l
|
||||
func (bot *CQBot) CQSendPrivateMessage(userID int64, groupId int64, i interface{}, autoEscape bool) MSG {
|
||||
func (bot *CQBot) CQSendPrivateMessage(userID int64, groupID int64, i interface{}, autoEscape bool) MSG {
|
||||
var str string
|
||||
if m, ok := i.(gjson.Result); ok {
|
||||
if m.Type == gjson.JSON {
|
||||
elem := bot.ConvertObjectMessage(m, false)
|
||||
mid := bot.SendPrivateMessage(userID, groupId, &message.SendingMessage{Elements: elem})
|
||||
mid := bot.SendPrivateMessage(userID, groupID, &message.SendingMessage{Elements: elem})
|
||||
if mid == -1 {
|
||||
return Failed(100, "SEND_MSG_API_ERROR", "请参考输出")
|
||||
}
|
||||
@ -468,7 +469,7 @@ func (bot *CQBot) CQSendPrivateMessage(userID int64, groupId int64, i interface{
|
||||
} else {
|
||||
elem = bot.ConvertStringMessage(str, false)
|
||||
}
|
||||
mid := bot.SendPrivateMessage(userID, groupId, &message.SendingMessage{Elements: elem})
|
||||
mid := bot.SendPrivateMessage(userID, groupID, &message.SendingMessage{Elements: elem})
|
||||
if mid == -1 {
|
||||
return Failed(100, "SEND_MSG_API_ERROR", "请参考输出")
|
||||
}
|
||||
@ -1053,7 +1054,7 @@ func (bot *CQBot) CQGetGroupMessageHistory(groupID int64, seq int64) MSG {
|
||||
log.Warnf("获取群历史消息失败: %v", err)
|
||||
return Failed(100, "MESSAGES_API_ERROR", err.Error())
|
||||
}
|
||||
var ms []MSG
|
||||
var ms = make([]MSG, len(msg))
|
||||
for _, m := range msg {
|
||||
id := m.Id
|
||||
bot.checkMedia(m.Elements)
|
||||
@ -1079,7 +1080,7 @@ func (bot *CQBot) CQGetOnlineClients(noCache bool) MSG {
|
||||
return Failed(100, "REFRESH_STATUS_ERROR", err.Error())
|
||||
}
|
||||
}
|
||||
var d []MSG
|
||||
var d = make([]MSG, len(bot.Client.OnlineClients))
|
||||
for _, oc := range bot.Client.OnlineClients {
|
||||
d = append(d, MSG{
|
||||
"app_id": oc.AppId,
|
||||
@ -1342,6 +1343,8 @@ func convertGroupMemberInfo(groupID int64, m *client.GroupMemberInfo) MSG {
|
||||
return "owner"
|
||||
case client.Administrator:
|
||||
return "admin"
|
||||
case client.Member:
|
||||
return "member"
|
||||
default:
|
||||
return "member"
|
||||
}
|
||||
|
34
coolq/bot.go
34
coolq/bot.go
@ -13,11 +13,12 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/syndtr/goleveldb/leveldb"
|
||||
@ -147,7 +148,7 @@ func (bot *CQBot) UploadLocalVideo(target int64, v *LocalVideoElement) (*message
|
||||
}
|
||||
defer video.Close()
|
||||
hash, _ := utils.ComputeMd5AndLength(io.MultiReader(video, v.thumb))
|
||||
cacheFile := path.Join(global.CachePath, hex.EncodeToString(hash[:])+".cache")
|
||||
cacheFile := path.Join(global.CachePath, hex.EncodeToString(hash)+".cache")
|
||||
_, _ = video.Seek(0, io.SeekStart)
|
||||
_, _ = v.thumb.Seek(0, io.SeekStart)
|
||||
return bot.Client.UploadGroupShortVideo(target, video, v.thumb, cacheFile)
|
||||
@ -171,7 +172,7 @@ func (bot *CQBot) UploadLocalImageAsPrivate(userID int64, img *LocalImageElement
|
||||
|
||||
// SendGroupMessage 发送群消息
|
||||
func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) int32 {
|
||||
var newElem []message.IMessageElement
|
||||
var newElem = make([]message.IMessageElement, 0, len(m.Elements))
|
||||
group := bot.Client.FindGroup(groupID)
|
||||
for _, elem := range m.Elements {
|
||||
if i, ok := elem.(*LocalImageElement); ok {
|
||||
@ -242,8 +243,8 @@ func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) int
|
||||
}
|
||||
|
||||
// SendPrivateMessage 发送私聊消息
|
||||
func (bot *CQBot) SendPrivateMessage(target int64, groupId int64, m *message.SendingMessage) int32 {
|
||||
var newElem []message.IMessageElement
|
||||
func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.SendingMessage) int32 {
|
||||
var newElem = make([]message.IMessageElement, 0, len(m.Elements))
|
||||
for _, elem := range m.Elements {
|
||||
if i, ok := elem.(*LocalImageElement); ok {
|
||||
fm, err := bot.UploadLocalImageAsPrivate(target, i)
|
||||
@ -294,21 +295,22 @@ func (bot *CQBot) SendPrivateMessage(target int64, groupId int64, m *message.Sen
|
||||
if msg != nil {
|
||||
id = bot.InsertPrivateMessage(msg)
|
||||
}
|
||||
} else if code, ok := bot.tempMsgCache.Load(target); ok || groupId != 0 { // 临时会话
|
||||
if bot.Client.FindGroup(groupId) == nil {
|
||||
log.Errorf("错误: 找不到群(%v)", groupId)
|
||||
} else if code, ok := bot.tempMsgCache.Load(target); ok || groupID != 0 { // 临时会话
|
||||
switch {
|
||||
case bot.Client.FindGroup(groupID) == nil:
|
||||
log.Errorf("错误: 找不到群(%v)", groupID)
|
||||
id = -1
|
||||
} else if groupId != 0 && !bot.Client.FindGroup(groupId).AdministratorOrOwner() {
|
||||
log.Errorf("错误: 机器人在群(%v) 为非管理员或群主, 无法主动发起临时会话", groupId)
|
||||
case groupID != 0 && !bot.Client.FindGroup(groupID).AdministratorOrOwner():
|
||||
log.Errorf("错误: 机器人在群(%v) 为非管理员或群主, 无法主动发起临时会话", groupID)
|
||||
id = -1
|
||||
} else if groupId != 0 && bot.Client.FindGroup(groupId).FindMember(target) == nil {
|
||||
log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupId)
|
||||
case groupID != 0 && bot.Client.FindGroup(groupID).FindMember(target) == nil:
|
||||
log.Errorf("错误: 群员(%v) 不在 群(%v), 无法发起临时会话", target, groupID)
|
||||
id = -1
|
||||
} else {
|
||||
default:
|
||||
if code != nil {
|
||||
groupId = code.(int64)
|
||||
groupID = code.(int64)
|
||||
}
|
||||
msg := bot.Client.SendTempMessage(groupId, target, m)
|
||||
msg := bot.Client.SendTempMessage(groupID, target, m)
|
||||
if msg != nil {
|
||||
id = bot.InsertTempMessage(target, msg)
|
||||
}
|
||||
@ -502,6 +504,8 @@ func (bot *CQBot) formatGroupMessage(m *message.GroupMessage) MSG {
|
||||
return "owner"
|
||||
case client.Administrator:
|
||||
return "admin"
|
||||
case client.Member:
|
||||
return "member"
|
||||
default:
|
||||
return "member"
|
||||
}
|
||||
|
@ -22,10 +22,11 @@ import (
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
@ -867,7 +868,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, isGroup bool) (m inte
|
||||
if !bytes.Equal(header, []byte{0x66, 0x74, 0x79, 0x70}) { // check file header ftyp
|
||||
_, _ = video.Seek(0, io.SeekStart)
|
||||
hash, _ := utils.ComputeMd5AndLength(video)
|
||||
cacheFile := path.Join(global.CachePath, hex.EncodeToString(hash[:])+".mp4")
|
||||
cacheFile := path.Join(global.CachePath, hex.EncodeToString(hash)+".mp4")
|
||||
if global.PathExists(cacheFile) && cache == "1" {
|
||||
goto ok
|
||||
}
|
||||
|
@ -8,10 +8,11 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/MiraiGo/message"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@ -238,6 +239,10 @@ func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
|
||||
return "performer"
|
||||
case client.Emotion:
|
||||
return "emotion"
|
||||
case client.Legend:
|
||||
return "legend"
|
||||
case client.StrongNewbie:
|
||||
return "strong_newbie"
|
||||
default:
|
||||
return "ERROR"
|
||||
}
|
||||
@ -248,8 +253,7 @@ func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
|
||||
|
||||
func (bot *CQBot) friendNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
|
||||
friend := c.FindFriend(e.From())
|
||||
switch notify := e.(type) {
|
||||
case *client.FriendPokeNotifyEvent:
|
||||
if notify, ok := e.(*client.FriendPokeNotifyEvent); ok {
|
||||
log.Infof("好友 %v 戳了戳你.", friend.Nickname)
|
||||
bot.dispatchEventMessage(MSG{
|
||||
"post_type": "notice",
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"path"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global/codec"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -83,21 +83,22 @@ func andOperatorConstruct(argument gjson.Result) *AndOperator {
|
||||
}
|
||||
op := new(AndOperator)
|
||||
argument.ForEach(func(key, value gjson.Result) bool {
|
||||
if key.Str[0] == '.' {
|
||||
switch {
|
||||
case key.Str[0] == '.':
|
||||
// is an operator
|
||||
// ".foo": {
|
||||
// "bar": "baz"
|
||||
// }
|
||||
opKey := key.Str[1:]
|
||||
op.operands = append(op.operands, operationNode{"", Generate(opKey, value)})
|
||||
} else if value.IsObject() {
|
||||
case value.IsObject():
|
||||
// is an normal key with an object as the value
|
||||
// "foo": {
|
||||
// ".bar": "baz"
|
||||
// }
|
||||
opKey := key.String()
|
||||
op.operands = append(op.operands, operationNode{opKey, Generate("and", value)})
|
||||
} else {
|
||||
default:
|
||||
// is an normal key with a non-object as the value
|
||||
// "foo": "bar"
|
||||
opKey := key.String()
|
||||
@ -112,7 +113,6 @@ func andOperatorConstruct(argument gjson.Result) *AndOperator {
|
||||
func (op *AndOperator) Eval(payload MSG) bool {
|
||||
res := true
|
||||
for _, operand := range op.operands {
|
||||
|
||||
if len(operand.key) == 0 {
|
||||
// is an operator
|
||||
res = res && operand.filter.Eval(payload)
|
||||
|
15
global/fs.go
15
global/fs.go
@ -83,11 +83,12 @@ func IsAMRorSILK(b []byte) bool {
|
||||
return bytes.HasPrefix(b, HeaderAmr) || bytes.HasPrefix(b, HeaderSilk)
|
||||
}
|
||||
|
||||
// FindFile 从给定的File寻找文件,并返回文件byte数组。File是一个合法的URL。Path为文件寻找位置。
|
||||
// FindFile 从给定的File寻找文件,并返回文件byte数组。File是一个合法的URL。p为文件寻找位置。
|
||||
// 对于HTTP/HTTPS形式的URL,Cache为"1"或空时表示启用缓存
|
||||
func FindFile(file, cache, PATH string) (data []byte, err error) {
|
||||
func FindFile(file, cache, p string) (data []byte, err error) {
|
||||
data, err = nil, ErrSyntax
|
||||
if strings.HasPrefix(file, "http") || strings.HasPrefix(file, "https") {
|
||||
switch {
|
||||
case strings.HasPrefix(file, "http") || strings.HasPrefix(file, "https"):
|
||||
if cache == "" {
|
||||
cache = "1"
|
||||
}
|
||||
@ -101,12 +102,12 @@ func FindFile(file, cache, PATH string) (data []byte, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(file, "base64") {
|
||||
case strings.HasPrefix(file, "base64"):
|
||||
data, err = base64.StdEncoding.DecodeString(strings.ReplaceAll(file, "base64://", ""))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(file, "file") {
|
||||
case strings.HasPrefix(file, "file"):
|
||||
var fu *url.URL
|
||||
fu, err = url.Parse(file)
|
||||
if err != nil {
|
||||
@ -119,8 +120,8 @@ func FindFile(file, cache, PATH string) (data []byte, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if PathExists(path.Join(PATH, file)) {
|
||||
data, err = ioutil.ReadFile(path.Join(PATH, file))
|
||||
case PathExists(path.Join(p, file)):
|
||||
data, err = ioutil.ReadFile(path.Join(p, file))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -140,7 +140,6 @@ func DownloadFileMultiThreading(url, path string, limit int64, threadCount int,
|
||||
|
||||
for k, v := range headers {
|
||||
req.Header.Set(k, v)
|
||||
|
||||
}
|
||||
if _, ok := headers["User-Agent"]; !ok {
|
||||
req.Header["User-Agent"] = []string{UserAgent}
|
||||
@ -150,6 +149,7 @@ func DownloadFileMultiThreading(url, path string, limit int64, threadCount int,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
return errors.New("response status unsuccessful: " + strconv.FormatInt(int64(resp.StatusCode), 10))
|
||||
}
|
||||
@ -169,7 +169,6 @@ func DownloadFileMultiThreading(url, path string, limit int64, threadCount int,
|
||||
return (contentLength / int64(threadCount)) - 10
|
||||
}
|
||||
return contentLength
|
||||
|
||||
}()
|
||||
if blockSize == contentLength {
|
||||
return copyStream(resp.Body)
|
||||
|
16
go.mod
16
go.mod
@ -3,26 +3,26 @@ module github.com/Mrs4s/go-cqhttp
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210308011115-8c89d62657af
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210315005315-55aef1b0ffd0
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/gin-contrib/pprof v1.3.0
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/guonaihong/gout v0.1.4
|
||||
github.com/guonaihong/gout v0.1.5
|
||||
github.com/hjson/hjson-go v3.1.0+incompatible
|
||||
github.com/jonboulle/clockwork v0.2.2 // indirect
|
||||
github.com/json-iterator/go v1.1.10
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||
github.com/lestrrat-go/strftime v1.0.4 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/syndtr/goleveldb v1.0.0
|
||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
||||
github.com/tidwall/gjson v1.6.8
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210207032612-169bbdf8861d
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210222130408-591ac9cef582
|
||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf
|
||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324
|
||||
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||
)
|
||||
|
65
go.sum
65
go.sum
@ -1,13 +1,11 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210305105331-e11fa95c501f h1:jwejWu/frFn1yf/VS7ZBKt1LU9ASU70kXCysQsXl6Ns=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210305105331-e11fa95c501f/go.mod h1:drSlh4LlYtjOMJxirScUCSnylBKi1NIRxUz7TKdSsNs=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210308011115-8c89d62657af h1:PPjWwM/KwbHzOyaEwKm3W5JrK6TTxpOSf+Sd4JXxF9s=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210308011115-8c89d62657af/go.mod h1:yhqA0NyKxUf7I/0HR/1OMchveFggX8wde04gqdGrNfU=
|
||||
github.com/a8m/syncmap v0.0.0-20200818084611-4bbbd178de97/go.mod h1:f3iF7/3t9i9hsYF8DPgT0XeIVyNzevhMCKf2445Q6pE=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210315005315-55aef1b0ffd0 h1:wCQr8EabWHuAuS6tgGOB4+RhvAA/s4AdMox7TeX2tQQ=
|
||||
github.com/Mrs4s/MiraiGo v0.0.0-20210315005315-55aef1b0ffd0/go.mod h1:NjiWhlvGxwv1ftOWIoiFa/OzklnAYI4YqNexFOKSZKw=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
@ -22,6 +20,7 @@ github.com/gin-gonic/gin v1.6.0/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwv
|
||||
github.com/gin-gonic/gin v1.6.2/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
@ -48,16 +47,21 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/guonaihong/gout v0.1.4 h1:uBBoyztMX9okC27OQxqhn6bZ0ROkGyvnEIHwtp3TM4g=
|
||||
github.com/guonaihong/gout v0.1.4/go.mod h1:0rFYAYyzbcxEg11eY2qUbffJs7hHRPeugAnlVYSp8Ic=
|
||||
github.com/guonaihong/gout v0.1.5 h1:1FeFFJWWdWYApBW9d6vzMDB4eR4Zr8T/gaVrjDVcl5U=
|
||||
github.com/guonaihong/gout v0.1.5/go.mod h1:0rFYAYyzbcxEg11eY2qUbffJs7hHRPeugAnlVYSp8Ic=
|
||||
github.com/hjson/hjson-go v3.1.0+incompatible h1:DY/9yE8ey8Zv22bY+mHV1uk2yRy0h8tKhZ77hEdi0Aw=
|
||||
github.com/hjson/hjson-go v3.1.0+incompatible/go.mod h1:qsetwF8NlsTsOTwZTApNlTCerV+b2GjYRRcIk4JMFio=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
|
||||
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
@ -66,6 +70,7 @@ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALr
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
|
||||
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
|
||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
|
||||
@ -75,28 +80,33 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
|
||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
|
||||
@ -112,13 +122,13 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210207032612-169bbdf8861d h1:gJTKbjZtlMt/almOeFi/UpVtT3RHqRWscgEuDtnF5TU=
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210207032612-169bbdf8861d/go.mod h1:twOxzexmM2Il1ReUu1fB5tnUotOq/dp56xjk/ZHwb1I=
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210222130408-591ac9cef582 h1:y8hYRWJ2Ei8KdyhGXEc+ET17EV2f5iPlCdUPNnnV5do=
|
||||
github.com/wdvxdr1123/go-silk v0.0.0-20210222130408-591ac9cef582/go.mod h1:bcqHmIqdf81oeyGS/MUhr9K5/rX7pl3N3iBcPCPlfJY=
|
||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189 h1:4UJw9if55Fu3HOwbfcaQlJ27p3oeJU2JZqoeT3ITJQk=
|
||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189/go.mod h1:rIrm5geMiBhPQkdfUm8gDFi/WiHneOp1i9KjmJqc+9I=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b h1:wSOdpTq0/eI46Ez/LkDwIsAKA71YP2SRKBODiRWM0as=
|
||||
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
@ -128,10 +138,9 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -139,27 +148,27 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201126233918-771906719818 h1:f1CIuDlJhwANEC2MM87MBEVMr3jl5bifgsfj90XAF9c=
|
||||
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324 h1:Hir2P/De0WpUhtrKGGjvSb2YxUgyZ7EFOSLIcSSpiwE=
|
||||
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190501045030-23463209683d/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@ -179,18 +188,22 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
modernc.org/libc v1.7.6 h1:P0qDJAlSR6hSAuE8mQgz9eH/GzigfEd3IIn7HmTQgT0=
|
||||
modernc.org/libc v1.7.6/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/libc v1.7.12 h1:x4NjVrgGXghep5yT0tQr9weJc++zboRWgJqQ1cXXEug=
|
||||
modernc.org/libc v1.7.12/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
|
||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
modernc.org/mathutil v1.2.2 h1:+yFk8hBprV+4c0U9GjFtL+dV3N8hOJ8JCituQcMShFY=
|
||||
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
||||
|
46
main.go
46
main.go
@ -9,9 +9,6 @@ import (
|
||||
"encoding/hex"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/go-cqhttp/global/terminal"
|
||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
easy "github.com/t-tomalak/logrus-easy-formatter"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -26,18 +23,21 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
"github.com/Mrs4s/go-cqhttp/global/terminal"
|
||||
"github.com/Mrs4s/go-cqhttp/server"
|
||||
"github.com/guonaihong/gout"
|
||||
"github.com/tidwall/gjson"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
"golang.org/x/term"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/binary"
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
"github.com/guonaihong/gout"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
log "github.com/sirupsen/logrus"
|
||||
easy "github.com/t-tomalak/logrus-easy-formatter"
|
||||
"github.com/tidwall/gjson"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
var json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
@ -47,7 +47,6 @@ var d bool
|
||||
var h bool
|
||||
|
||||
func init() {
|
||||
|
||||
flag.BoolVar(&d, "d", false, "running as a daemon")
|
||||
flag.BoolVar(&h, "h", false, "this help")
|
||||
flag.Parse()
|
||||
@ -424,14 +423,14 @@ func selfUpdate(imageURL string) {
|
||||
runtime.GOARCH,
|
||||
)
|
||||
if runtime.GOOS == "windows" {
|
||||
url = url + ".exe"
|
||||
url += ".exe"
|
||||
}
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
log.Error("更新失败!")
|
||||
log.Error("更新失败: ", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
wc := global.WriteCounter{}
|
||||
err, _ = global.UpdateFromStream(io.TeeReader(resp.Body, &wc))
|
||||
fmt.Println()
|
||||
@ -455,10 +454,10 @@ func selfUpdate(imageURL string) {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func restart(Args []string) {
|
||||
func restart(args []string) {
|
||||
var cmd *exec.Cmd
|
||||
if runtime.GOOS == "windows" {
|
||||
file, err := exec.LookPath(Args[0])
|
||||
file, err := exec.LookPath(args[0])
|
||||
if err != nil {
|
||||
log.Errorf("重启失败:%s", err.Error())
|
||||
return
|
||||
@ -467,18 +466,18 @@ func restart(Args []string) {
|
||||
if err != nil {
|
||||
log.Errorf("重启失败:%s", err.Error())
|
||||
}
|
||||
Args = append([]string{"/c", "start ", path, "faststart"}, Args[1:]...)
|
||||
args = append([]string{"/c", "start ", path, "faststart"}, args[1:]...)
|
||||
cmd = &exec.Cmd{
|
||||
Path: "cmd.exe",
|
||||
Args: Args,
|
||||
Args: args,
|
||||
Stderr: os.Stderr,
|
||||
Stdout: os.Stdout,
|
||||
}
|
||||
} else {
|
||||
Args = append(Args, "faststart")
|
||||
args = append(args, "faststart")
|
||||
cmd = &exec.Cmd{
|
||||
Path: Args[0],
|
||||
Args: Args,
|
||||
Path: args[0],
|
||||
Args: args,
|
||||
Stderr: os.Stderr,
|
||||
Stdout: os.Stdout,
|
||||
}
|
||||
@ -488,11 +487,12 @@ func restart(Args []string) {
|
||||
|
||||
func getConfig() *global.JSONConfig {
|
||||
var conf *global.JSONConfig
|
||||
if global.PathExists("config.json") {
|
||||
switch {
|
||||
case global.PathExists("config.json"):
|
||||
conf = global.LoadConfig("config.json")
|
||||
_ = conf.Save("config.hjson")
|
||||
_ = os.Remove("config.json")
|
||||
} else if os.Getenv("UIN") != "" {
|
||||
case os.Getenv("UIN") != "":
|
||||
log.Infof("将从环境变量加载配置.")
|
||||
uin, _ := strconv.ParseInt(os.Getenv("UIN"), 10, 64)
|
||||
pwd := os.Getenv("PASS")
|
||||
@ -517,7 +517,7 @@ func getConfig() *global.JSONConfig {
|
||||
if post != "" {
|
||||
conf.HTTPConfig.PostUrls[post] = os.Getenv("HTTP_SECRET")
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
conf = global.LoadConfig("config.hjson")
|
||||
}
|
||||
if conf == nil {
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
)
|
||||
|
||||
@ -202,7 +203,6 @@ func setRestart(_ *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
Restart <- struct{}{}
|
||||
}(delay)
|
||||
return coolq.MSG{"data": nil, "retcode": 0, "status": "async"}
|
||||
|
||||
}
|
||||
|
||||
func canSendImage(bot *coolq.CQBot, _ resultGetter) coolq.MSG {
|
||||
@ -293,7 +293,7 @@ func getEssenceMsgList(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
return bot.CQGetEssenceMessageList(p.Get("group_id").Int())
|
||||
}
|
||||
|
||||
func checkUrlSafely(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
func checkURLSafely(bot *coolq.CQBot, p resultGetter) coolq.MSG {
|
||||
return bot.CQCheckURLSafely(p.Get("url").String())
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ var API = map[string]func(*coolq.CQBot, resultGetter) coolq.MSG{
|
||||
"set_essence_msg": setEssenceMSG,
|
||||
"delete_essence_msg": deleteEssenceMSG,
|
||||
"get_essence_msg_list": getEssenceMsgList,
|
||||
"check_url_safely": checkUrlSafely,
|
||||
"check_url_safely": checkURLSafely,
|
||||
"set_group_anonymous_ban": setGroupAnonymousBan,
|
||||
".handle_quick_operation": handleQuickOperation,
|
||||
}
|
||||
@ -376,7 +376,6 @@ var API = map[string]func(*coolq.CQBot, resultGetter) coolq.MSG{
|
||||
func (api *apiCaller) callAPI(action string, p resultGetter) coolq.MSG {
|
||||
if f, ok := API[action]; ok {
|
||||
return f(api.bot, p)
|
||||
} else {
|
||||
}
|
||||
return coolq.Failed(404, "API_NOT_FOUND", "API不存在")
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/gin-contrib/pprof"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/client"
|
||||
"github.com/Mrs4s/MiraiGo/utils"
|
||||
"github.com/gin-contrib/pprof"
|
||||
"github.com/gin-gonic/gin"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -119,7 +119,6 @@ func (s *webServer) Run(addr string, cli *client.QQClient) *coolq.CQBot {
|
||||
|
||||
// logincore 登录核心实现
|
||||
func (s *webServer) logincore(relogin bool) {
|
||||
|
||||
s.Console = bufio.NewReader(os.Stdin)
|
||||
readLine := func() (str string) {
|
||||
str, _ = s.Console.ReadString('\n')
|
||||
@ -134,7 +133,6 @@ func (s *webServer) logincore(relogin bool) {
|
||||
|
||||
var times uint = 1 // 重试次数
|
||||
for res, err := s.Cli.Login(); ; res, err = s.Cli.Login() {
|
||||
|
||||
var text string
|
||||
count := 0
|
||||
|
||||
@ -270,7 +268,7 @@ func (s *webServer) logincore(relogin bool) {
|
||||
}
|
||||
log.Info(text)
|
||||
continue
|
||||
case client.OtherLoginError, client.UnknownLoginError:
|
||||
case client.OtherLoginError, client.UnknownLoginError, client.TooManySMSRequestError:
|
||||
msg := res.ErrorMessage
|
||||
if strings.Contains(msg, "版本") {
|
||||
msg = "密码错误或账号被冻结"
|
||||
@ -312,7 +310,6 @@ func (s *webServer) logincore(relogin bool) {
|
||||
|
||||
// Dologin 主程序登录
|
||||
func (s *webServer) Dologin() {
|
||||
|
||||
s.Cli.AllowSlider = true
|
||||
s.logincore(false)
|
||||
log.Infof("登录成功 欢迎使用: %v", s.Cli.Nickname)
|
||||
@ -407,15 +404,18 @@ func AuthMiddleWare() gin.HandlerFunc {
|
||||
c.Set("json_body", gjson.ParseBytes(d))
|
||||
}
|
||||
authToken := conf.AccessToken
|
||||
if auth := c.Request.Header.Get("Authorization"); auth != "" {
|
||||
auth := c.Request.Header.Get("Authorization")
|
||||
switch {
|
||||
case auth != "":
|
||||
if strings.SplitN(auth, " ", 2)[1] != authToken {
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
}
|
||||
} else if c.Query("access_token") != authToken {
|
||||
c.Next()
|
||||
case c.Query("access_token") != authToken:
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
} else {
|
||||
default:
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
@ -658,5 +658,4 @@ func AdminDoConfigJSON(s *webServer, c *gin.Context) {
|
||||
func AdminGetConfigJSON(s *webServer, c *gin.Context) {
|
||||
conf := GetConf()
|
||||
c.JSON(200, coolq.OK(coolq.MSG{"config": conf}))
|
||||
|
||||
}
|
||||
|
@ -4,13 +4,15 @@ package server
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Daemon go-cqhttp server 的 daemon的实现函数
|
||||
@ -60,15 +62,12 @@ func GetCurrentPath() (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
//fmt.Println("path111:", path)
|
||||
if runtime.GOOS == "windows" {
|
||||
path = strings.Replace(path, "\\", "/", -1)
|
||||
path = strings.ReplaceAll(path, "\\", "/")
|
||||
}
|
||||
//fmt.Println("path222:", path)
|
||||
i := strings.LastIndex(path, "/")
|
||||
if i < 0 {
|
||||
return "",errors.New("system/path_error,Can't find '/' or '\\'");
|
||||
return "", errors.New("system/path_error,Can't find '/' or '\\'")
|
||||
}
|
||||
//fmt.Println("path333:", path)
|
||||
return string(path[0 : i+1]), nil
|
||||
return path[0 : i+1], nil
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/guonaihong/gout"
|
||||
"github.com/guonaihong/gout/dataflow"
|
||||
@ -72,15 +73,15 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
|
||||
|
||||
if authToken != "" {
|
||||
s.engine.Use(func(c *gin.Context) {
|
||||
if auth := c.Request.Header.Get("Authorization"); auth != "" {
|
||||
if strings.SplitN(auth, " ", 2)[1] != authToken {
|
||||
auth := c.Request.Header.Get("Authorization")
|
||||
switch {
|
||||
case auth != "" && strings.SplitN(auth, " ", 2)[1] != authToken:
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
}
|
||||
} else if c.Query("access_token") != authToken {
|
||||
case c.Query("access_token") != authToken:
|
||||
c.AbortWithStatus(401)
|
||||
return
|
||||
} else {
|
||||
default:
|
||||
c.Next()
|
||||
}
|
||||
})
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||
"github.com/Mrs4s/go-cqhttp/global"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/gjson"
|
||||
@ -97,7 +98,7 @@ func (c *WebSocketClient) connectAPI() {
|
||||
if c.token != "" {
|
||||
header["Authorization"] = []string{"Token " + c.token}
|
||||
}
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseAPIURL, header)
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseAPIURL, header) // nolint
|
||||
if err != nil {
|
||||
log.Warnf("连接到反向WebSocket API服务器 %v 时出现错误: %v", c.conf.ReverseAPIURL, err)
|
||||
if c.conf.ReverseReconnectInterval != 0 {
|
||||
@ -121,7 +122,7 @@ func (c *WebSocketClient) connectEvent() {
|
||||
if c.token != "" {
|
||||
header["Authorization"] = []string{"Token " + c.token}
|
||||
}
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseEventURL, header)
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseEventURL, header) // nolint
|
||||
if err != nil {
|
||||
log.Warnf("连接到反向WebSocket Event服务器 %v 时出现错误: %v", c.conf.ReverseEventURL, err)
|
||||
if c.conf.ReverseReconnectInterval != 0 {
|
||||
@ -152,7 +153,7 @@ func (c *WebSocketClient) connectUniversal() {
|
||||
if c.token != "" {
|
||||
header["Authorization"] = []string{"Token " + c.token}
|
||||
}
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseURL, header)
|
||||
conn, _, err := websocket.DefaultDialer.Dial(c.conf.ReverseURL, header) // nolint
|
||||
if err != nil {
|
||||
log.Warnf("连接到反向WebSocket Universal服务器 %v 时出现错误: %v", c.conf.ReverseURL, err)
|
||||
if c.conf.ReverseReconnectInterval != 0 {
|
||||
@ -161,7 +162,6 @@ func (c *WebSocketClient) connectUniversal() {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
handshake := fmt.Sprintf(`{"meta_event_type":"lifecycle","post_type":"meta_event","self_id":%d,"sub_type":"connect","time":%d}`,
|
||||
c.bot.Client.Uin, time.Now().Unix())
|
||||
err = conn.WriteMessage(websocket.TextMessage, []byte(handshake))
|
||||
@ -184,7 +184,6 @@ func (c *WebSocketClient) listenAPI(conn *webSocketConn, u bool) {
|
||||
}
|
||||
|
||||
go conn.handleRequest(c.bot, buf)
|
||||
|
||||
}
|
||||
if c.conf.ReverseReconnectInterval != 0 {
|
||||
time.Sleep(time.Millisecond * time.Duration(c.conf.ReverseReconnectInterval))
|
||||
|
Loading…
x
Reference in New Issue
Block a user