mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-06-30 11:53:25 +00:00
Compare commits
29 Commits
v0.9.27
...
v0.9.28-fi
Author | SHA1 | Date | |
---|---|---|---|
c619ee7feb | |||
a53e549e6c | |||
a6c13b68cd | |||
7659a214d6 | |||
b7d3aec9b7 | |||
584159d285 | |||
6d2f464bee | |||
e719c86731 | |||
c984f22d4f | |||
aaa73ef5f5 | |||
a72a688a62 | |||
1d7f1cc5d5 | |||
24937f2386 | |||
73bd756c20 | |||
9d58c56b35 | |||
6879197107 | |||
a979c46563 | |||
e8513da090 | |||
2a5f78499b | |||
b167231787 | |||
7ae9c2d220 | |||
31f24525f0 | |||
51101f02cd | |||
4d404eacd9 | |||
ff29e16220 | |||
d4811d53e7 | |||
b19b114d3a | |||
95c399a003 | |||
e3f0dbc4ac |
@ -665,7 +665,7 @@ func (bot *CQBot) CQCanSendRecord() MSG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bot *CQBot) CQOcrImage(imageId string) MSG {
|
func (bot *CQBot) CQOcrImage(imageId string) MSG {
|
||||||
img, err := bot.makeImageElem("image", map[string]string{"file": imageId}, true)
|
img, err := bot.makeImageElem(map[string]string{"file": imageId}, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("load image error: %v", err)
|
log.Warnf("load image error: %v", err)
|
||||||
return Failed(100)
|
return Failed(100)
|
||||||
|
77
coolq/bot.go
77
coolq/bot.go
@ -66,6 +66,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
|
|||||||
bot.Client.OnGroupMemberJoined(bot.memberJoinEvent)
|
bot.Client.OnGroupMemberJoined(bot.memberJoinEvent)
|
||||||
bot.Client.OnGroupMemberLeaved(bot.memberLeaveEvent)
|
bot.Client.OnGroupMemberLeaved(bot.memberLeaveEvent)
|
||||||
bot.Client.OnGroupMemberPermissionChanged(bot.memberPermissionChangedEvent)
|
bot.Client.OnGroupMemberPermissionChanged(bot.memberPermissionChangedEvent)
|
||||||
|
bot.Client.OnGroupMemberCardUpdated(bot.memberCardUpdatedEvent)
|
||||||
bot.Client.OnNewFriendRequest(bot.friendRequestEvent)
|
bot.Client.OnNewFriendRequest(bot.friendRequestEvent)
|
||||||
bot.Client.OnNewFriendAdded(bot.friendAddedEvent)
|
bot.Client.OnNewFriendAdded(bot.friendAddedEvent)
|
||||||
bot.Client.OnGroupInvited(bot.groupInvitedEvent)
|
bot.Client.OnGroupInvited(bot.groupInvitedEvent)
|
||||||
@ -151,6 +152,48 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
|
|||||||
bot.Client.SendGroupGift(uint64(groupId), uint64(i.Target), i.GiftId)
|
bot.Client.SendGroupGift(uint64(groupId), uint64(i.Target), i.GiftId)
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
if i, ok := elem.(*QQMusicElement); ok {
|
||||||
|
var msgStyle uint32 = 4
|
||||||
|
if i.MusicUrl == "" {
|
||||||
|
msgStyle = 0 // fix vip song
|
||||||
|
}
|
||||||
|
ret, err := bot.Client.SendGroupRichMessage(groupId, 100497308, 1, msgStyle, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.tencent.qqmusic",
|
||||||
|
Signature: "cbd27cd7c861227d013a25b2d10f0799",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("警告: 群 %v 富文本消息发送失败: %v", groupId, err)
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return bot.InsertGroupMessage(ret)
|
||||||
|
}
|
||||||
|
if i, ok := elem.(*CloudMusicElement); ok {
|
||||||
|
ret, err := bot.Client.SendGroupRichMessage(groupId, 100495085, 1, 4, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.netease.cloudmusic",
|
||||||
|
Signature: "da6b069da1e2982db3e386233f68d76d",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("警告: 群 %v 富文本消息发送失败: %v", groupId, err)
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return bot.InsertGroupMessage(ret)
|
||||||
|
}
|
||||||
newElem = append(newElem, elem)
|
newElem = append(newElem, elem)
|
||||||
}
|
}
|
||||||
m.Elements = newElem
|
m.Elements = newElem
|
||||||
@ -174,6 +217,40 @@ func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) in
|
|||||||
newElem = append(newElem, fm)
|
newElem = append(newElem, fm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if i, ok := elem.(*QQMusicElement); ok {
|
||||||
|
var msgStyle uint32 = 4
|
||||||
|
if i.MusicUrl == "" {
|
||||||
|
msgStyle = 0 // fix vip song
|
||||||
|
}
|
||||||
|
bot.Client.SendFriendRichMessage(target, 100497308, 1, msgStyle, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.tencent.qqmusic",
|
||||||
|
Signature: "cbd27cd7c861227d013a25b2d10f0799",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if i, ok := elem.(*CloudMusicElement); ok {
|
||||||
|
bot.Client.SendFriendRichMessage(target, 100495085, 1, 4, client.RichClientInfo{
|
||||||
|
Platform: 1,
|
||||||
|
SdkVersion: "0.0.0",
|
||||||
|
PackageName: "com.netease.cloudmusic",
|
||||||
|
Signature: "da6b069da1e2982db3e386233f68d76d",
|
||||||
|
}, &message.RichMessage{
|
||||||
|
Title: i.Title,
|
||||||
|
Summary: i.Summary,
|
||||||
|
Url: i.Url,
|
||||||
|
PictureUrl: i.PictureUrl,
|
||||||
|
MusicUrl: i.MusicUrl,
|
||||||
|
})
|
||||||
|
return 0
|
||||||
|
}
|
||||||
newElem = append(newElem, elem)
|
newElem = append(newElem, elem)
|
||||||
}
|
}
|
||||||
m.Elements = newElem
|
m.Elements = newElem
|
||||||
|
103
coolq/cqcode.go
103
coolq/cqcode.go
@ -35,10 +35,30 @@ type GiftElement struct {
|
|||||||
GiftId message.GroupGift
|
GiftId message.GroupGift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MusicElement struct {
|
||||||
|
Title string
|
||||||
|
Summary string
|
||||||
|
Url string
|
||||||
|
PictureUrl string
|
||||||
|
MusicUrl string
|
||||||
|
}
|
||||||
|
|
||||||
|
type QQMusicElement struct {
|
||||||
|
MusicElement
|
||||||
|
}
|
||||||
|
|
||||||
|
type CloudMusicElement struct {
|
||||||
|
MusicElement
|
||||||
|
}
|
||||||
|
|
||||||
func (e *GiftElement) Type() message.ElementType {
|
func (e *GiftElement) Type() message.ElementType {
|
||||||
return message.At
|
return message.At
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *MusicElement) Type() message.ElementType {
|
||||||
|
return message.Service
|
||||||
|
}
|
||||||
|
|
||||||
var GiftId = []message.GroupGift{
|
var GiftId = []message.GroupGift{
|
||||||
message.SweetWink,
|
message.SweetWink,
|
||||||
message.HappyCola,
|
message.HappyCola,
|
||||||
@ -342,12 +362,48 @@ func (bot *CQBot) ConvertObjectMessage(m gjson.Result, group bool) (r []message.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.IMessageElement, error) {
|
func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (m message.IMessageElement, err error) {
|
||||||
switch t {
|
switch t {
|
||||||
case "text":
|
case "text":
|
||||||
return message.NewText(d["text"]), nil
|
return message.NewText(d["text"]), nil
|
||||||
case "image":
|
case "image":
|
||||||
return bot.makeImageElem(t, d, group)
|
img,err := bot.makeImageElem(d, group)
|
||||||
|
if err != nil{
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
tp := d["type"]
|
||||||
|
if tp != "show" && tp != "flash" {
|
||||||
|
return img, nil
|
||||||
|
}
|
||||||
|
if i, ok := img.(*message.ImageElement); ok { // 秀图,闪照什么的就直接传了吧
|
||||||
|
if group {
|
||||||
|
img, err = bot.Client.UploadGroupImage(1, i.Data)
|
||||||
|
} else {
|
||||||
|
img, err = bot.Client.UploadPrivateImage(1, i.Data)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch tp {
|
||||||
|
case "flash":
|
||||||
|
if i, ok := img.(*message.GroupImageElement); ok{
|
||||||
|
return &message.GroupFlashPicElement{GroupImageElement: *i},nil
|
||||||
|
}
|
||||||
|
if i, ok := img.(*message.FriendImageElement); ok{
|
||||||
|
return &message.FriendFlashPicElement{FriendImageElement: *i},nil
|
||||||
|
}
|
||||||
|
case "show":
|
||||||
|
id, _ := strconv.ParseInt(d["id"], 10, 64)
|
||||||
|
if id < 40000 || id >= 40006 {
|
||||||
|
id = 40000
|
||||||
|
}
|
||||||
|
if i, ok := img.(*message.GroupImageElement); ok{
|
||||||
|
return &message.GroupShowPicElement{GroupImageElement: *i,EffectId: int32(id)},nil
|
||||||
|
}
|
||||||
|
return img,nil // 私聊还没做
|
||||||
|
}
|
||||||
|
|
||||||
case "poke":
|
case "poke":
|
||||||
if !group {
|
if !group {
|
||||||
return nil, errors.New("todo") // TODO: private poke
|
return nil, errors.New("todo") // TODO: private poke
|
||||||
@ -368,7 +424,14 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
if !group {
|
if !group {
|
||||||
return nil, errors.New("private voice unsupported now")
|
return nil, errors.New("private voice unsupported now")
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if r := recover();r != nil {
|
||||||
|
m = nil
|
||||||
|
err = errors.New("tts 转换失败")
|
||||||
|
}
|
||||||
|
}()
|
||||||
data, err := bot.Client.GetTts(d["text"])
|
data, err := bot.Client.GetTts(d["text"])
|
||||||
|
ioutil.WriteFile("tts.silk", data, 777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -383,7 +446,10 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !global.IsAMRorSILK(data) {
|
if !global.IsAMRorSILK(data) {
|
||||||
return nil, errors.New("unsupported voice file format (please use AMR file for now)")
|
data, err = global.Encoder(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return &message.VoiceElement{Data: data}, nil
|
return &message.VoiceElement{Data: data}, nil
|
||||||
case "face":
|
case "face":
|
||||||
@ -425,8 +491,13 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
if d["content"] != "" {
|
if d["content"] != "" {
|
||||||
content = d["content"]
|
content = d["content"]
|
||||||
}
|
}
|
||||||
json := fmt.Sprintf("{\"app\": \"com.tencent.structmsg\",\"desc\": \"音乐\",\"meta\": {\"music\": {\"desc\": \"%s\",\"jumpUrl\": \"%s\",\"musicUrl\": \"%s\",\"preview\": \"%s\",\"tag\": \"QQ音乐\",\"title\": \"%s\"}},\"prompt\": \"[分享]%s\",\"ver\": \"0.0.0.1\",\"view\": \"music\"}", content, jumpUrl, purl, preview, name, name)
|
return &QQMusicElement{MusicElement: MusicElement{
|
||||||
return message.NewLightApp(json), nil
|
Title: name,
|
||||||
|
Summary: content,
|
||||||
|
Url: jumpUrl,
|
||||||
|
PictureUrl: preview,
|
||||||
|
MusicUrl: purl,
|
||||||
|
}}, nil
|
||||||
}
|
}
|
||||||
if d["type"] == "163" {
|
if d["type"] == "163" {
|
||||||
info, err := global.NeteaseMusicSongInfo(d["id"])
|
info, err := global.NeteaseMusicSongInfo(d["id"])
|
||||||
@ -444,8 +515,13 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
if info.Get("artists.0").Exists() {
|
if info.Get("artists.0").Exists() {
|
||||||
artistName = info.Get("artists.0.name").Str
|
artistName = info.Get("artists.0.name").Str
|
||||||
}
|
}
|
||||||
json := fmt.Sprintf("{\"app\": \"com.tencent.structmsg\",\"desc\":\"音乐\",\"view\":\"music\",\"prompt\":\"[分享]%s\",\"ver\":\"0.0.0.1\",\"meta\":{ \"music\": { \"desc\": \"%s\", \"jumpUrl\": \"%s\", \"musicUrl\": \"%s\", \"preview\": \"%s\", \"tag\": \"网易云音乐\", \"title\":\"%s\"}}}", name, artistName, jumpUrl, musicUrl, picUrl, name)
|
return &CloudMusicElement{MusicElement{
|
||||||
return message.NewLightApp(json), nil
|
Title: name,
|
||||||
|
Summary: artistName,
|
||||||
|
Url: jumpUrl,
|
||||||
|
PictureUrl: picUrl,
|
||||||
|
MusicUrl: musicUrl,
|
||||||
|
}}, nil
|
||||||
}
|
}
|
||||||
if d["type"] == "custom" {
|
if d["type"] == "custom" {
|
||||||
xml := fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="2" templateID="1" action="web" brief="[分享] %s" sourceMsgId="0" url="%s" flag="0" adverSign="0" multiMsgFlag="0"><item layout="2"><audio cover="%s" src="%s"/><title>%s</title><summary>%s</summary></item><source name="音乐" icon="https://i.gtimg.cn/open/app_icon/01/07/98/56/1101079856_100_m.png" url="http://web.p.qq.com/qqmpmobile/aio/app.html?id=1101079856" action="app" a_actionData="com.tencent.qqmusic" i_actionData="tencent1101079856://" appid="1101079856" /></msg>`,
|
xml := fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="2" templateID="1" action="web" brief="[分享] %s" sourceMsgId="0" url="%s" flag="0" adverSign="0" multiMsgFlag="0"><item layout="2"><audio cover="%s" src="%s"/><title>%s</title><summary>%s</summary></item><source name="音乐" icon="https://i.gtimg.cn/open/app_icon/01/07/98/56/1101079856_100_m.png" url="http://web.p.qq.com/qqmpmobile/aio/app.html?id=1101079856" action="app" a_actionData="com.tencent.qqmusic" i_actionData="tencent1101079856://" appid="1101079856" /></msg>`,
|
||||||
@ -495,7 +571,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
if maxheight == 0 {
|
if maxheight == 0 {
|
||||||
maxheight = 1000
|
maxheight = 1000
|
||||||
}
|
}
|
||||||
img, err := bot.makeImageElem(t, d, group)
|
img, err := bot.makeImageElem(d, group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.New("send cardimage faild")
|
return nil, errors.New("send cardimage faild")
|
||||||
}
|
}
|
||||||
@ -503,6 +579,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
|
|||||||
default:
|
default:
|
||||||
return nil, errors.New("unsupported cq code: " + t)
|
return nil, errors.New("unsupported cq code: " + t)
|
||||||
}
|
}
|
||||||
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CQCodeEscapeText(raw string) string {
|
func CQCodeEscapeText(raw string) string {
|
||||||
@ -534,7 +611,7 @@ func CQCodeUnescapeValue(content string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 图片 elem 生成器,单独拎出来,用于公用
|
// 图片 elem 生成器,单独拎出来,用于公用
|
||||||
func (bot *CQBot) makeImageElem(t string, d map[string]string, group bool) (message.IMessageElement, error) {
|
func (bot *CQBot) makeImageElem(d map[string]string, group bool) (message.IMessageElement, error) {
|
||||||
f := d["file"]
|
f := d["file"]
|
||||||
if strings.HasPrefix(f, "http") || strings.HasPrefix(f, "https") {
|
if strings.HasPrefix(f, "http") || strings.HasPrefix(f, "https") {
|
||||||
cache := d["cache"]
|
cache := d["cache"]
|
||||||
@ -582,7 +659,7 @@ func (bot *CQBot) makeImageElem(t string, d map[string]string, group bool) (mess
|
|||||||
rawPath += ".cqimg"
|
rawPath += ".cqimg"
|
||||||
}
|
}
|
||||||
if !global.PathExists(rawPath) && d["url"] != "" {
|
if !global.PathExists(rawPath) && d["url"] != "" {
|
||||||
return bot.ToElement(t, map[string]string{"file": d["url"]}, group)
|
return bot.makeImageElem(map[string]string{"file": d["url"]}, group)
|
||||||
}
|
}
|
||||||
if global.PathExists(rawPath) {
|
if global.PathExists(rawPath) {
|
||||||
b, err := ioutil.ReadFile(rawPath)
|
b, err := ioutil.ReadFile(rawPath)
|
||||||
@ -618,7 +695,7 @@ func (bot *CQBot) makeImageElem(t string, d map[string]string, group bool) (mess
|
|||||||
}
|
}
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
if url != "" {
|
if url != "" {
|
||||||
return bot.ToElement(t, map[string]string{"file": url}, group)
|
return bot.makeImageElem(map[string]string{"file": url}, group)
|
||||||
}
|
}
|
||||||
return nil, errors.New("img size is 0")
|
return nil, errors.New("img size is 0")
|
||||||
}
|
}
|
||||||
@ -629,7 +706,7 @@ func (bot *CQBot) makeImageElem(t string, d map[string]string, group bool) (mess
|
|||||||
rsp, err := bot.Client.QueryGroupImage(1, hash, size)
|
rsp, err := bot.Client.QueryGroupImage(1, hash, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if url != "" {
|
if url != "" {
|
||||||
return bot.ToElement(t, map[string]string{"file": url}, group)
|
return bot.makeImageElem(map[string]string{"file": url}, group)
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -638,7 +715,7 @@ func (bot *CQBot) makeImageElem(t string, d map[string]string, group bool) (mess
|
|||||||
rsp, err := bot.Client.QueryFriendImage(1, hash, size)
|
rsp, err := bot.Client.QueryFriendImage(1, hash, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if url != "" {
|
if url != "" {
|
||||||
return bot.ToElement(t, map[string]string{"file": url}, group)
|
return bot.makeImageElem(map[string]string{"file": url}, group)
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -310,6 +310,20 @@ func (bot *CQBot) memberPermissionChangedEvent(c *client.QQClient, e *client.Mem
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bot *CQBot) memberCardUpdatedEvent(c *client.QQClient, e *client.MemberCardUpdatedEvent) {
|
||||||
|
log.Infof("群 %v 的 %v 更新了名片 %v -> %v", formatGroupName(e.Group), formatMemberName(e.Member), e.OldCard, e.Member.CardName)
|
||||||
|
bot.dispatchEventMessage(MSG{
|
||||||
|
"post_type": "notice",
|
||||||
|
"notice_type": "group_card",
|
||||||
|
"group_id": e.Group.Code,
|
||||||
|
"user_id": e.Member.Uin,
|
||||||
|
"card_new": e.Member.CardName,
|
||||||
|
"card_old": e.OldCard,
|
||||||
|
"time": time.Now().Unix(),
|
||||||
|
"self_id": c.Uin,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (bot *CQBot) memberJoinEvent(c *client.QQClient, e *client.MemberJoinGroupEvent) {
|
func (bot *CQBot) memberJoinEvent(c *client.QQClient, e *client.MemberJoinGroupEvent) {
|
||||||
log.Infof("新成员 %v 进入了群 %v.", formatMemberName(e.Member), formatGroupName(e.Group))
|
log.Infof("新成员 %v 进入了群 %v.", formatMemberName(e.Member), formatGroupName(e.Group))
|
||||||
bot.dispatchEventMessage(bot.groupIncrease(e.Group.Code, 0, e.Member.Uin))
|
bot.dispatchEventMessage(bot.groupIncrease(e.Group.Code, 0, e.Member.Uin))
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
# 常见问题
|
# 常见问题
|
||||||
|
|
||||||
### Q: 为什么登录的时候出现 `客户端版本过低 请升级客户端`?
|
|
||||||
|
|
||||||
### A: 此问题是因为密码输入错误导致的, 信息为服务器返回, 很可能是TX相关的错误, 请检查密码
|
|
||||||
|
|
||||||
### Q: 为什么登录的时候出现 `为了您的帐号安全,请使用QQ一键登录`?
|
|
||||||
|
|
||||||
### A: 因为目前手机协议不支持图片验证码,切换成平板协议登录成功后,再切换回手机协议即可
|
|
||||||
|
|
||||||
### Q: 为什么挂一段时间后就会出现 `消息发送失败,账号可能被风控`?
|
### Q: 为什么挂一段时间后就会出现 `消息发送失败,账号可能被风控`?
|
||||||
|
|
||||||
### A: 如果你刚开始使用 go-cqhttp 建议挂机3-7天,即可解除风控
|
### A: 如果你刚开始使用 go-cqhttp 建议挂机3-7天,即可解除风控
|
||||||
|
232
docs/adminApi.md
Normal file
232
docs/adminApi.md
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
# 管理 API
|
||||||
|
|
||||||
|
> 支持跨域
|
||||||
|
|
||||||
|
## 公共参数
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ----------- |
|
||||||
|
| access_token | string | 校验口令,config.json中配置 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## admin/do_restart
|
||||||
|
|
||||||
|
### 热重启
|
||||||
|
|
||||||
|
> 热重启
|
||||||
|
|
||||||
|
> ps: 目前不支持ws部分的修改生效
|
||||||
|
|
||||||
|
method:`POST/GET`
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ---- | ------------------------------------- |
|
||||||
|
| 无|||
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### admin/get_web_write
|
||||||
|
|
||||||
|
> 拉取验证码/设备锁
|
||||||
|
|
||||||
|
method: `GET`
|
||||||
|
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ----------- |
|
||||||
|
| 无|||
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {"ispic": true,"picbase64":"xxxxx"}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ----------- |
|
||||||
|
| ispic| bool| 是否是验证码类型 true是,false为不是(比如设备锁|
|
||||||
|
|picbas64| string| 验证码的base64编码内容,加上头,放入img标签即可显示|
|
||||||
|
|
||||||
|
### admin/do_web_write
|
||||||
|
|
||||||
|
> web输入验证码/设备锁确认
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ----------- |
|
||||||
|
| input | string | 输入的类容 |
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### admin/do_restart_docker
|
||||||
|
|
||||||
|
> 冷重启
|
||||||
|
|
||||||
|
> 注意:此api 会直接结束掉进程,需要依赖docker/supervisor等进程管理工具来自动拉起
|
||||||
|
|
||||||
|
method: `POST`
|
||||||
|
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 |类型 | 说明 |
|
||||||
|
| ------ | ------ | -----------|
|
||||||
|
| 无 | | |
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### admin/do_config_base
|
||||||
|
|
||||||
|
> 基础配置
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| uin | string | qq号 |
|
||||||
|
| password | string | qq密码 |
|
||||||
|
| enable_db | string | 是否启动数据库,填 'true' 或者 'false' |
|
||||||
|
| access_token | string | 授权 token |
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### admin/do_config_http
|
||||||
|
|
||||||
|
> http服务配置
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| port | string | 服务端口 |
|
||||||
|
| host | string | 服务监听地址 |
|
||||||
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
|
| timeout | string | http请求超时时间 |
|
||||||
|
| post_url | string | post上报地址 不需要就填空字符串,或者不填|
|
||||||
|
| post_secret | string | post上报的secret 不需要就填空字符串,或者不填 |
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### admin/do_config_ws
|
||||||
|
|
||||||
|
> 正向ws设置
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| port | string | 服务端口 |
|
||||||
|
| host | string | 服务监听地址 |
|
||||||
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
|
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### admin/do_config_reverse
|
||||||
|
|
||||||
|
> 反向ws配置
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| port | string | 服务端口 |
|
||||||
|
| host | string | 服务监听地址 |
|
||||||
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
|
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### admin/do_config_json
|
||||||
|
|
||||||
|
> 直接修改 config.json配置
|
||||||
|
|
||||||
|
method: `POST` formdata
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| json | string | 完整的config.json的配合,json字符串 |
|
||||||
|
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### admin/get_config_json
|
||||||
|
|
||||||
|
> 获取当前 config.json配置
|
||||||
|
|
||||||
|
method: `GET`
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| 无 | | |
|
||||||
|
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {"config":"xxxx"}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ------ | ------------------------------------------------------------ |
|
||||||
|
| config | string | 完整的config.json的配合,json字符串 |
|
||||||
|
|
@ -4,6 +4,28 @@
|
|||||||
|
|
||||||
## CQCode
|
## CQCode
|
||||||
|
|
||||||
|
### 图片
|
||||||
|
|
||||||
|
| 参数名 | 可能的值 | 说明 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `file` | - | 图片文件名 |
|
||||||
|
| `type` | `flash`,`show` | 图片类型,`flash` 表示闪照,`show` 表示秀图,默认普通图片 |
|
||||||
|
| `url` | - | 图片 URL |
|
||||||
|
| `cache` | `0` `1` | 只在通过网络 URL 发送时有效,表示是否使用已缓存的文件,默认 `1` |
|
||||||
|
| `id` | - | 发送秀图时的特效id,默认为40000 |
|
||||||
|
|
||||||
|
可用的特效ID:
|
||||||
|
|
||||||
|
| id |类型 |
|
||||||
|
| --- |-------|
|
||||||
|
| 40000 | 普通 |
|
||||||
|
| 40001 | 幻影 |
|
||||||
|
| 40002 | 抖动 |
|
||||||
|
| 40003 | 生日 |
|
||||||
|
| 40004 | 爱你 |
|
||||||
|
| 40005 | 征友 |
|
||||||
|
|
||||||
|
|
||||||
### 回复
|
### 回复
|
||||||
|
|
||||||
Type : `reply`
|
Type : `reply`
|
||||||
@ -520,3 +542,20 @@ Type: `tts`
|
|||||||
| `sub_type` | string | `honor` | 提示类型 |
|
| `sub_type` | string | `honor` | 提示类型 |
|
||||||
| `user_id` | int64 | | 成员id |
|
| `user_id` | int64 | | 成员id |
|
||||||
| `honor_type` | string | `talkative:龙王` `performer:群聊之火` `emotion:快乐源泉` | 荣誉类型 |
|
| `honor_type` | string | `talkative:龙王` `performer:群聊之火` `emotion:快乐源泉` | 荣誉类型 |
|
||||||
|
|
||||||
|
#### 群成员名片更新
|
||||||
|
|
||||||
|
> 注意: 此事件不保证时效性,仅在收到消息时校验卡片
|
||||||
|
|
||||||
|
**上报数据**
|
||||||
|
|
||||||
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
|
| ------------- | ------ | -------------- | -------------- |
|
||||||
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
|
| `notice_type` | string | `group_card` | 消息类型 |
|
||||||
|
| `group_id` | int64 | | 群号 |
|
||||||
|
| `user_id` | int64 | | 成员id |
|
||||||
|
| `card_new` | int64 | | 新名片 |
|
||||||
|
| `card_old` | int64 | | 旧名片 |
|
||||||
|
|
||||||
|
> PS: 当名片为空时 `card_xx` 字段为空字符串, 并不是昵称
|
44
global/codec.go
Normal file
44
global/codec.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package global
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/wdvxdr1123/go-silk/silk"
|
||||||
|
"io/ioutil"
|
||||||
|
"path"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var codec silk.Encoder
|
||||||
|
var useCodec = true
|
||||||
|
var once sync.Once
|
||||||
|
|
||||||
|
func InitCodec() {
|
||||||
|
once.Do(func() {
|
||||||
|
log.Info("正在加载silk编码器...")
|
||||||
|
err := codec.Init("data/cache", "codec")
|
||||||
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
|
useCodec = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func Encoder(data []byte) ([]byte, error) {
|
||||||
|
if useCodec == false {
|
||||||
|
return nil, errors.New("no silk encoder")
|
||||||
|
}
|
||||||
|
h := md5.New()
|
||||||
|
h.Write(data)
|
||||||
|
tempName := fmt.Sprintf("%x", h.Sum(nil))
|
||||||
|
if silkPath := path.Join("data/cache", tempName+".silk"); PathExists(silkPath) {
|
||||||
|
return ioutil.ReadFile(silkPath)
|
||||||
|
}
|
||||||
|
slk, err := codec.EncodeToSilk(data, tempName, true)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return slk, nil
|
||||||
|
}
|
@ -81,6 +81,7 @@ type GoCQReverseWebsocketConfig struct {
|
|||||||
|
|
||||||
type GoCqWebUi struct {
|
type GoCqWebUi struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
Host string `json:"host"`
|
||||||
WebUiPort uint64 `json:"web_ui_port"`
|
WebUiPort uint64 `json:"web_ui_port"`
|
||||||
WebInput bool `json:"web_input"`
|
WebInput bool `json:"web_input"`
|
||||||
}
|
}
|
||||||
@ -130,6 +131,7 @@ func DefaultConfig() *JsonConfig {
|
|||||||
},
|
},
|
||||||
WebUi: &GoCqWebUi{
|
WebUi: &GoCqWebUi{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
|
Host: "0.0.0.0",
|
||||||
WebInput: false,
|
WebInput: false,
|
||||||
WebUiPort: 9999,
|
WebUiPort: 9999,
|
||||||
},
|
},
|
||||||
|
14
go.mod
14
go.mod
@ -3,29 +3,19 @@ module github.com/Mrs4s/go-cqhttp
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201003051902-8a968656c116
|
github.com/Mrs4s/MiraiGo v0.0.0-20201013050256-7b392cacdb79
|
||||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
|
||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.6.3
|
||||||
github.com/go-playground/validator/v10 v10.4.0 // indirect
|
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
github.com/guonaihong/gout v0.1.2
|
github.com/guonaihong/gout v0.1.2
|
||||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
|
||||||
github.com/jonboulle/clockwork v0.2.0 // indirect
|
|
||||||
github.com/json-iterator/go v1.1.10 // indirect
|
|
||||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||||
github.com/lestrrat-go/strftime v1.0.3 // indirect
|
github.com/lestrrat-go/strftime v1.0.3 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||||
github.com/sirupsen/logrus v1.7.0
|
github.com/sirupsen/logrus v1.7.0
|
||||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
||||||
github.com/tebeka/strftime v0.1.5 // indirect
|
|
||||||
github.com/tidwall/gjson v1.6.1
|
github.com/tidwall/gjson v1.6.1
|
||||||
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6
|
||||||
github.com/xujiajun/nutsdb v0.5.0
|
github.com/xujiajun/nutsdb v0.5.0
|
||||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
|
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
||||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
34
go.sum
34
go.sum
@ -1,11 +1,7 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
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/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201002083653-383954dc11e2 h1:Pjs3pQKXDxvaWf3zTLmedRl+F1gvcJl+bp3XaYFg4Yw=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201013050256-7b392cacdb79 h1:t9PK37mnl5tbilG+FMUY1hZujoDjFr8iO8upwYHww5c=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201002083653-383954dc11e2/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201013050256-7b392cacdb79/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201002092940-afe4132a38d5 h1:NVXpGL7tssdjYBAsPRvCIL8f8V9e8n9YO8sSsOwdy44=
|
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201002092940-afe4132a38d5/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
|
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201003051902-8a968656c116 h1:GQHsohWh9LxaWmHIVS2tKzZZSysJBrnS+Sh5jXZ+5zk=
|
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201003051902-8a968656c116/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
|
|
||||||
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||||
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
@ -14,7 +10,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
|||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
|
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||||
@ -27,9 +22,8 @@ github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTM
|
|||||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
|
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
||||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||||
github.com/go-playground/validator/v10 v10.4.0 h1:72qIR/m8ybvL8L5TIyfgrigqkrw7kVYAvjEvpT85l70=
|
|
||||||
github.com/go-playground/validator/v10 v10.4.0/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
@ -54,11 +48,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
|
|||||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/guonaihong/gout v0.1.2 h1:TR2XCRopGgJdj231IayEoeavgbznFXzzzcZVdT/hG10=
|
github.com/guonaihong/gout v0.1.2 h1:TR2XCRopGgJdj231IayEoeavgbznFXzzzcZVdT/hG10=
|
||||||
github.com/guonaihong/gout v0.1.2/go.mod h1:vXvv5Kxr70eM5wrp4F0+t9lnLWmq+YPW2GByll2f/EA=
|
github.com/guonaihong/gout v0.1.2/go.mod h1:vXvv5Kxr70eM5wrp4F0+t9lnLWmq+YPW2GByll2f/EA=
|
||||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
|
|
||||||
github.com/jonboulle/clockwork v0.2.0/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
|
|
||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
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.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||||
@ -72,9 +63,7 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y
|
|||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
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 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
@ -94,7 +83,6 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
|||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
|
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
|
||||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
|
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
|
||||||
github.com/tebeka/strftime v0.1.5/go.mod h1:29/OidkoWHdEKZqzyDLUyC+LmgDgdHo4WAFCDT7D/Ig=
|
|
||||||
github.com/tidwall/gjson v1.6.1 h1:LRbvNuNuvAiISWg6gxLEFuCe72UKy5hDqhxW/8183ws=
|
github.com/tidwall/gjson v1.6.1 h1:LRbvNuNuvAiISWg6gxLEFuCe72UKy5hDqhxW/8183ws=
|
||||||
github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
||||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
||||||
@ -105,6 +93,8 @@ 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 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 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6 h1:lX18MCdNzT2zIi7K02x4C5cPkDXpL+wCb1YTAMXjLWQ=
|
||||||
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6/go.mod h1:5q9LFlBr+yX/J8Jd/9wHdXwkkjFkNyQIS7kX2Lgx/Zs=
|
||||||
github.com/xujiajun/gorouter v1.2.0/go.mod h1:yJrIta+bTNpBM/2UT8hLOaEAFckO+m/qmR3luMIQygM=
|
github.com/xujiajun/gorouter v1.2.0/go.mod h1:yJrIta+bTNpBM/2UT8hLOaEAFckO+m/qmR3luMIQygM=
|
||||||
github.com/xujiajun/mmap-go v1.0.1 h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc=
|
github.com/xujiajun/mmap-go v1.0.1 h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc=
|
||||||
github.com/xujiajun/mmap-go v1.0.1/go.mod h1:CNN6Sw4SL69Sui00p0zEzcZKbt+5HtEnYUsc6BKKRMg=
|
github.com/xujiajun/mmap-go v1.0.1/go.mod h1:CNN6Sw4SL69Sui00p0zEzcZKbt+5HtEnYUsc6BKKRMg=
|
||||||
@ -115,8 +105,6 @@ github.com/xujiajun/utils v0.0.0-20190123093513-8bf096c4f53b/go.mod h1:AZd87GYJl
|
|||||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189 h1:4UJw9if55Fu3HOwbfcaQlJ27p3oeJU2JZqoeT3ITJQk=
|
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=
|
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-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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
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-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
@ -125,10 +113,8 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r
|
|||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/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-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-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 h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 h1:YfxMZzv3PjGonQYNUaeU2+DhAdqOxerQ30JFB6WgAXo=
|
|
||||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
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-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -136,14 +122,11 @@ 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-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/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-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-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/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 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
|
||||||
@ -176,8 +159,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
|||||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||||
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
||||||
gopkg.in/yaml.v2 v2.2.2/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.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
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=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
6
main.go
6
main.go
@ -237,17 +237,21 @@ func main() {
|
|||||||
conf.WebUi = &global.GoCqWebUi{
|
conf.WebUi = &global.GoCqWebUi{
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
WebInput: false,
|
WebInput: false,
|
||||||
|
Host: "0.0.0.0",
|
||||||
WebUiPort: 9999,
|
WebUiPort: 9999,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if conf.WebUi.WebUiPort <= 0 {
|
if conf.WebUi.WebUiPort <= 0 {
|
||||||
conf.WebUi.WebUiPort = 9999
|
conf.WebUi.WebUiPort = 9999
|
||||||
}
|
}
|
||||||
|
if conf.WebUi.Host == "" {
|
||||||
|
conf.WebUi.Host = "0.0.0.0"
|
||||||
|
}
|
||||||
confErr := conf.Save("config.json")
|
confErr := conf.Save("config.json")
|
||||||
if confErr != nil {
|
if confErr != nil {
|
||||||
log.Error("保存配置文件失败")
|
log.Error("保存配置文件失败")
|
||||||
}
|
}
|
||||||
b := server.WebServer.Run(fmt.Sprintf("%s:%d", "0.0.0.0", conf.WebUi.WebUiPort), cli)
|
b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUi.Host, conf.WebUi.WebUiPort), cli)
|
||||||
c := server.Console
|
c := server.Console
|
||||||
signal.Notify(c, os.Interrupt, os.Kill)
|
signal.Notify(c, os.Interrupt, os.Kill)
|
||||||
<-c
|
<-c
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"os/signal"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -49,7 +50,7 @@ var HttpuriAdmin = map[string]func(s *webServer, c *gin.Context){
|
|||||||
"do_config_ws": AdminDoConfigWs, //修改config.json的正向ws部分
|
"do_config_ws": AdminDoConfigWs, //修改config.json的正向ws部分
|
||||||
"do_config_reverse": AdminDoConfigReverse, //修改config.json 中的反向ws部分
|
"do_config_reverse": AdminDoConfigReverse, //修改config.json 中的反向ws部分
|
||||||
"do_config_json": AdminDoConfigJson, //直接修改 config.json配置
|
"do_config_json": AdminDoConfigJson, //直接修改 config.json配置
|
||||||
"get_config_json": AdminDoConfigJson, //拉取 当前的config.json配置
|
"get_config_json": AdminGetConfigJson, //拉取 当前的config.json配置
|
||||||
}
|
}
|
||||||
|
|
||||||
func Failed(code int, msg string) coolq.MSG {
|
func Failed(code int, msg string) coolq.MSG {
|
||||||
@ -69,12 +70,21 @@ func (s *webServer) Run(addr string, cli *client.QQClient) *coolq.CQBot {
|
|||||||
s.engine.Any("/admin/:action", s.admin)
|
s.engine.Any("/admin/:action", s.admin)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Infof("Admin API 服务器已启动: %v", addr)
|
//开启端口监听
|
||||||
err := s.engine.Run(addr)
|
if s.Conf.WebUi.Enabled {
|
||||||
if err != nil {
|
log.Infof("Admin API 服务器已启动: %v", addr)
|
||||||
log.Error(err)
|
err := s.engine.Run(addr)
|
||||||
log.Infof("请检查端口是否被占用.")
|
if err != nil {
|
||||||
time.Sleep(time.Second * 5)
|
log.Error(err)
|
||||||
|
log.Infof("请检查端口是否被占用.")
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//关闭端口监听
|
||||||
|
c := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(c, os.Interrupt, os.Kill)
|
||||||
|
<-c
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -86,42 +96,95 @@ func (s *webServer) Run(addr string, cli *client.QQClient) *coolq.CQBot {
|
|||||||
|
|
||||||
func (s *webServer) Dologin() {
|
func (s *webServer) Dologin() {
|
||||||
s.Console = bufio.NewReader(os.Stdin)
|
s.Console = bufio.NewReader(os.Stdin)
|
||||||
|
readLine := func() (str string) {
|
||||||
|
_, _ = fmt.Scanf("%s", &str)
|
||||||
|
return
|
||||||
|
}
|
||||||
conf := GetConf()
|
conf := GetConf()
|
||||||
cli := s.Cli
|
cli := s.Cli
|
||||||
|
cli.AllowSlider = true
|
||||||
rsp, err := cli.Login()
|
rsp, err := cli.Login()
|
||||||
for {
|
for {
|
||||||
global.Check(err)
|
global.Check(err)
|
||||||
var text string
|
var text string
|
||||||
if !rsp.Success {
|
if !rsp.Success {
|
||||||
switch rsp.Error {
|
switch rsp.Error {
|
||||||
|
case client.SliderNeededError:
|
||||||
|
if client.SystemDeviceInfo.Protocol == client.AndroidPhone {
|
||||||
|
log.Warnf("警告: Android Phone 强制要求暂不支持的滑条验证码, 请开启设备锁或切换到Watch协议验证通过后再使用.")
|
||||||
|
log.Infof("按 Enter 继续....")
|
||||||
|
readLine()
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
cli.AllowSlider = false
|
||||||
|
cli.Disconnect()
|
||||||
|
rsp, err = cli.Login()
|
||||||
|
continue
|
||||||
case client.NeedCaptcha:
|
case client.NeedCaptcha:
|
||||||
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0644)
|
_ = ioutil.WriteFile("captcha.jpg", rsp.CaptchaImage, 0644)
|
||||||
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
|
img, _, _ := image.Decode(bytes.NewReader(rsp.CaptchaImage))
|
||||||
fmt.Println(asciiart.New("image", img).Art)
|
fmt.Println(asciiart.New("image", img).Art)
|
||||||
if conf.WebUi.WebInput {
|
if conf.WebUi.WebInput {
|
||||||
log.Warn("请输入验证码 (captcha.jpg): (http://127.0.0.1/admin/web_write 输入)")
|
log.Warnf("请输入验证码 (captcha.jpg): (http://%s:%d/admin/do_web_write 输入)", conf.WebUi.Host, conf.WebUi.WebUiPort)
|
||||||
text = <-WebInput
|
text = <-WebInput
|
||||||
} else {
|
} else {
|
||||||
log.Warn("请输入验证码 (captcha.jpg): (Enter 提交)")
|
log.Warn("请输入验证码 (captcha.jpg): (Enter 提交)")
|
||||||
text, _ = s.Console.ReadString('\n')
|
text = readLine()
|
||||||
}
|
}
|
||||||
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
|
rsp, err = cli.SubmitCaptcha(strings.ReplaceAll(text, "\n", ""), rsp.CaptchaSign)
|
||||||
global.DelFile("captcha.jpg")
|
global.DelFile("captcha.jpg")
|
||||||
continue
|
continue
|
||||||
|
case client.SMSNeededError:
|
||||||
|
log.Warnf("账号已开启设备锁, 按下 Enter 向手机 %v 发送短信验证码.", rsp.SMSPhone)
|
||||||
|
readLine()
|
||||||
|
if !cli.RequestSMS() {
|
||||||
|
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
log.Warn("请输入短信验证码: (Enter 提交)")
|
||||||
|
text = readLine()
|
||||||
|
rsp, err = cli.SubmitSMS(strings.ReplaceAll(strings.ReplaceAll(text, "\n", ""), "\r", ""))
|
||||||
|
continue
|
||||||
|
case client.SMSOrVerifyNeededError:
|
||||||
|
log.Warnf("账号已开启设备锁,请选择验证方式:")
|
||||||
|
log.Warnf("1. 向手机 %v 发送短信验证码", rsp.SMSPhone)
|
||||||
|
log.Warnf("2. 使用手机QQ扫码验证.")
|
||||||
|
log.Warn("请输入(1 - 2): ")
|
||||||
|
text = readLine()
|
||||||
|
if strings.Contains(text, "1") {
|
||||||
|
if !cli.RequestSMS() {
|
||||||
|
log.Warnf("发送验证码失败,可能是请求过于频繁.")
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
log.Warn("请输入短信验证码: (Enter 提交)")
|
||||||
|
text = readLine()
|
||||||
|
rsp, err = cli.SubmitSMS(strings.ReplaceAll(strings.ReplaceAll(text, "\n", ""), "\r", ""))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
log.Warnf("请前往 -> %v <- 验证并重启Bot.", rsp.VerifyUrl)
|
||||||
|
log.Infof("按 Enter 继续....")
|
||||||
|
readLine()
|
||||||
|
os.Exit(0)
|
||||||
|
return
|
||||||
case client.UnsafeDeviceError:
|
case client.UnsafeDeviceError:
|
||||||
log.Warnf("账号已开启设备锁,请前往 -> %v <- 验证并重启Bot.", rsp.VerifyUrl)
|
log.Warnf("账号已开启设备锁,请前往 -> %v <- 验证并重启Bot.", rsp.VerifyUrl)
|
||||||
if conf.WebUi.WebInput {
|
if conf.WebUi.WebInput {
|
||||||
log.Infof(" (http://127.0.0.1/admin/web_write 确认后继续)....")
|
log.Infof(" (http://%s:%d/admin/do_web_write 确认后继续)....", conf.WebUi.Host, conf.WebUi.WebUiPort)
|
||||||
text = <-WebInput
|
text = <-WebInput
|
||||||
} else {
|
} else {
|
||||||
log.Infof(" 按 Enter 继续....")
|
log.Infof("按 Enter 继续....")
|
||||||
_, _ = s.Console.ReadString('\n')
|
readLine()
|
||||||
}
|
}
|
||||||
log.Info(text)
|
log.Info(text)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
return
|
return
|
||||||
case client.OtherLoginError, client.UnknownLoginError:
|
case client.OtherLoginError, client.UnknownLoginError:
|
||||||
log.Fatalf("登录失败: %v", rsp.ErrorMessage)
|
log.Warnf("登录失败: %v", rsp.ErrorMessage)
|
||||||
|
log.Infof("按 Enter 继续....")
|
||||||
|
readLine()
|
||||||
|
os.Exit(0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,7 +202,6 @@ func (s *webServer) Dologin() {
|
|||||||
if conf.PostMessageFormat != "string" && conf.PostMessageFormat != "array" {
|
if conf.PostMessageFormat != "string" && conf.PostMessageFormat != "array" {
|
||||||
log.Warnf("post_message_format 配置错误, 将自动使用 string")
|
log.Warnf("post_message_format 配置错误, 将自动使用 string")
|
||||||
coolq.SetMessageFormat("string")
|
coolq.SetMessageFormat("string")
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
coolq.SetMessageFormat(conf.PostMessageFormat)
|
coolq.SetMessageFormat(conf.PostMessageFormat)
|
||||||
}
|
}
|
||||||
@ -148,6 +210,7 @@ func (s *webServer) Dologin() {
|
|||||||
}
|
}
|
||||||
log.Info("正在加载事件过滤器.")
|
log.Info("正在加载事件过滤器.")
|
||||||
global.BootFilter()
|
global.BootFilter()
|
||||||
|
global.InitCodec()
|
||||||
coolq.IgnoreInvalidCQCode = conf.IgnoreInvalidCQCode
|
coolq.IgnoreInvalidCQCode = conf.IgnoreInvalidCQCode
|
||||||
coolq.ForceFragmented = conf.ForceFragmented
|
coolq.ForceFragmented = conf.ForceFragmented
|
||||||
log.Info("资源初始化完成, 开始处理信息.")
|
log.Info("资源初始化完成, 开始处理信息.")
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
type httpServer struct {
|
type httpServer struct {
|
||||||
engine *gin.Engine
|
engine *gin.Engine
|
||||||
bot *coolq.CQBot
|
bot *coolq.CQBot
|
||||||
Http *http.Server
|
Http *http.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpClient struct {
|
type httpClient struct {
|
||||||
@ -81,9 +81,9 @@ func (s *httpServer) Run(addr, authToken string, bot *coolq.CQBot) {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
log.Infof("CQ HTTP 服务器已启动: %v", addr)
|
log.Infof("CQ HTTP 服务器已启动: %v", addr)
|
||||||
s.Http=&http.Server{
|
s.Http = &http.Server{
|
||||||
Addr:addr,
|
Addr: addr,
|
||||||
Handler:s.engine,
|
Handler: s.engine,
|
||||||
}
|
}
|
||||||
if err := s.Http.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := s.Http.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
@ -553,4 +553,4 @@ func (s *httpServer) ShutDown() {
|
|||||||
log.Println("timeout of 5 seconds.")
|
log.Println("timeout of 5 seconds.")
|
||||||
}
|
}
|
||||||
log.Println("http Server exiting")
|
log.Println("http Server exiting")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user