Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
go-cqhttp
Commits
e386a52f
Commit
e386a52f
authored
Oct 02, 2020
by
scjtqs
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
a6a1de0a
4c8ae2f0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
267 additions
and
30 deletions
+267
-30
coolq/api.go
coolq/api.go
+14
-4
coolq/bot.go
coolq/bot.go
+4
-0
coolq/cqcode.go
coolq/cqcode.go
+31
-0
docs/QA.md
docs/QA.md
+13
-0
docs/cqhttp.md
docs/cqhttp.md
+54
-0
docs/quick_start.md
docs/quick_start.md
+121
-1
global/config.go
global/config.go
+1
-1
global/fs.go
global/fs.go
+3
-2
go.mod
go.mod
+5
-5
go.sum
go.sum
+14
-16
server/apiAdmin.go
server/apiAdmin.go
+4
-0
server/http.go
server/http.go
+3
-1
No files found.
coolq/api.go
View file @
e386a52f
...
...
@@ -6,6 +6,7 @@ import (
"path"
"runtime"
"strconv"
"strings"
"time"
"github.com/Mrs4s/MiraiGo/binary"
...
...
@@ -125,7 +126,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
if
mid
==
-
1
{
return
Failed
(
100
)
}
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
m
.
String
(
),
mid
)
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
limitedString
(
m
.
String
()
),
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
}
str
=
func
()
string
{
...
...
@@ -152,7 +153,7 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}, autoEscape bo
if
mid
==
-
1
{
return
Failed
(
100
)
}
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
str
,
mid
)
log
.
Infof
(
"发送群 %v(%v) 的消息: %v (%v)"
,
groupId
,
groupId
,
limitedString
(
str
)
,
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
}
...
...
@@ -249,7 +250,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
if
mid
==
-
1
{
return
Failed
(
100
)
}
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
m
.
String
(
),
mid
)
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
limitedString
(
m
.
String
()
),
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
}
str
=
func
()
string
{
...
...
@@ -274,7 +275,7 @@ func (bot *CQBot) CQSendPrivateMessage(userId int64, i interface{}, autoEscape b
if
mid
==
-
1
{
return
Failed
(
100
)
}
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
str
,
mid
)
log
.
Infof
(
"发送好友 %v(%v) 的消息: %v (%v)"
,
userId
,
userId
,
limitedString
(
str
)
,
mid
)
return
OK
(
MSG
{
"message_id"
:
mid
})
}
...
...
@@ -758,3 +759,12 @@ func convertGroupMemberInfo(groupId int64, m *client.GroupMemberInfo) MSG {
"card_changeable"
:
false
,
}
}
func
limitedString
(
str
string
)
string
{
if
strings
.
Count
(
str
,
""
)
<=
10
{
return
str
}
limited
:=
[]
rune
(
str
)
limited
=
limited
[
:
10
]
return
string
(
limited
)
+
" ..."
}
coolq/bot.go
View file @
e386a52f
...
...
@@ -147,6 +147,10 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
}
}
}
if
i
,
ok
:=
elem
.
(
*
GiftElement
);
ok
{
bot
.
Client
.
SendGroupGift
(
uint64
(
groupId
),
uint64
(
i
.
Target
),
i
.
GiftId
)
return
0
}
newElem
=
append
(
newElem
,
elem
)
}
m
.
Elements
=
newElem
...
...
coolq/cqcode.go
View file @
e386a52f
...
...
@@ -30,6 +30,27 @@ type PokeElement struct {
Target
int64
}
type
GiftElement
struct
{
Target
int64
GiftId
message
.
GroupGift
}
func
(
e
*
GiftElement
)
Type
()
message
.
ElementType
{
return
message
.
At
}
var
GiftId
=
[]
message
.
GroupGift
{
message
.
SweetWink
,
message
.
HappyCola
,
message
.
LuckyBracelet
,
message
.
Cappuccino
,
message
.
CatWatch
,
message
.
FleeceGloves
,
message
.
RainbowCandy
,
message
.
Stronger
,
message
.
LoveMicrophone
,
}
func
(
e
*
PokeElement
)
Type
()
message
.
ElementType
{
return
message
.
At
}
...
...
@@ -333,6 +354,16 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (message.
}
t
,
_
:=
strconv
.
ParseInt
(
d
[
"qq"
],
10
,
64
)
return
&
PokeElement
{
Target
:
t
},
nil
case
"gift"
:
if
!
group
{
return
nil
,
errors
.
New
(
"private gift unsupported"
)
// no free private gift
}
t
,
_
:=
strconv
.
ParseInt
(
d
[
"qq"
],
10
,
64
)
id
,
_
:=
strconv
.
Atoi
(
d
[
"id"
])
if
id
<
0
||
id
>=
9
{
return
nil
,
errors
.
New
(
"invalid gift id"
)
}
return
&
GiftElement
{
Target
:
t
,
GiftId
:
GiftId
[
id
]},
nil
case
"record"
:
if
!
group
{
return
nil
,
errors
.
New
(
"private voice unsupported now"
)
...
...
docs/QA.md
0 → 100644
View file @
e386a52f
# 常见问题
### Q: 为什么登录的时候出现 `客户端版本过低 请升级客户端`?
### A: 此问题是因为密码输入错误导致的, 信息为服务器返回, 很可能是TX相关的错误, 请检查密码
### Q: 为什么登录的时候出现 `为了您的帐号安全,请使用QQ一键登录`?
### A: 因为目前手机协议不支持图片验证码,切换成平板协议登录成功后,再切换回手机协议即可
### Q: 为什么挂一段时间后就会出现 `消息发送失败,账号可能被风控`?
### A: 如果你刚开始使用 go-cqhttp 建议挂机3-7天,即可解除风控
docs/cqhttp.md
View file @
e386a52f
...
...
@@ -48,6 +48,38 @@ Type: `poke`
示例:
`[CQ:poke,qq=123456]`
### 礼物
> 注意:仅支持免费礼物,发送群礼物消息无法撤回,返回的 `message id` 恒定为 `0`
Type:
`gift`
范围:
**发送(仅群聊,接收的时候不是CQ码)**
参数:
| 参数名 |类型 | 说明 |
| ------ | ------ | -----------|
| qq | int64 | 接收礼物的成员 |
| id | int | 礼物的类型 |
目前支持的礼物ID:
| id |类型 |
| ---| ---------|
| 0 | 甜Wink |
| 1 | 快乐肥宅水|
| 2 | 幸运手链 |
| 3 | 卡布奇诺 |
| 4 | 猫咪手表 |
| 5 | 绒绒手套 |
| 6 | 彩虹糖果 |
| 7 | 坚强 |
| 8 | 告白话筒 |
示例:
`[CQ:gift,qq=123456,id=8]`
### 合并转发
Type:
`forward`
...
...
@@ -268,6 +300,28 @@ Type: `cardimage`
| group_id | int64 | 群号 |
| group_name | string | 新名 |
### 设置群头像
终结点:
`/set_group_portrait`
**参数**
| 字段 | 类型 | 说明 |
| -------- | ------ | ---- |
| group_id | int64 | 群号 |
| file | string | 图片文件名 |
| cache | int | 表示是否使用已缓存的文件 |
[1]
`file`
参数支持以下几种格式:
-
绝对路径,例如
`file:///C:\\Users\Richard\Pictures\1.png`
,格式使用
[
`file` URI
](
https://tools.ietf.org/html/rfc8089
)
-
网络 URL,例如
`http://i1.piimg.com/567571/fdd6e7b6d93f1ef0.jpg`
-
Base64 编码,例如
`base64://iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAIAAADJt1n/AAAAKElEQVQ4EWPk5+RmIBcwkasRpG9UM4mhNxpgowFGMARGEwnBIEJVAAAdBgBNAZf+QAAAAABJRU5ErkJggg==`
[2]
`cache`
参数: 通过网络 URL 发送时有效,
`1`
表示使用缓存,
`0`
关闭关闭缓存,默认 为
`1`
[3] 目前这个API在登录一段时间后因cookie失效而失效,请考虑后使用
### 获取图片信息
终结点:
`/get_image`
...
...
docs/quick_start.md
View file @
e386a52f
# 开始
欢迎来到 go-cqhttp 文档 目前还在咕
\ No newline at end of file
欢迎来到 go-cqhttp 文档 目前还在咕
# 基础教程
## 下载
从
[
release
](
https://github.com/Mrs4s/go-cqhttp/releases
)
界面下载最新版本的go-cqhttp
-
Windows下32位文件为
`go-cqhttp-v*-windows-386.zip`
-
Windows下64位文件为
`go-cqhttp-v*-windows-amd64.zip`
-
Windows下arm用(如使用高通CPU的笔记本)文件为
`go-cqhttp-v*-windows-arm.zip`
-
Linux下32位文件为
`go-cqhttp-v*-linux-386.tar.gz`
-
Linux下64位文件为
`go-cqhttp-v*-linux-amd64.tar.gz`
-
Linux下arm用(如树莓派)文件为
`go-cqhttp-v*-linux-arm.tar.gz`
-
MD5文件为
`*.md5`
,用于校验文件完整性
-
如果没有你所使用的系统版本或者希望自己构建,请移步
[
进阶指南-如何自己构建
](
#如何自己构建
)
## 解压
-
Windows下请使用自己熟悉的解压软件自行解压
-
Linux下在命令行中输入
`tar -xzvf [文件名]`
## 使用
### Windows
#### 标准方法
1.
双击
`go-cqhttp.exe`
此时将提示
```
[WARNING]: 尝试加载配置文件 config.json 失败: 文件不存在
[INFO]: 默认配置文件已生成,请编辑 config.json 后重启程序.
```
2.
参照
[
config.md
](
https://github.com/Mrs4s/go-cqhttp/blob/master/docs/config.md
)
和你所用到的插件的
`README`
填入参数
3.
再次双击
`go-cqhttp.exe`
```
[INFO]: 登录成功 欢迎使用: balabala
```
如出现需要认证的信息,请自行认证设备。
此时,基础配置完成
#### 懒人法
1.
[
下载包含Windows.bat的zip
](
https://github.com/fkx4-p/go-cqhttp-lazy/archive/master.zip
)
2.
解压
3.
将
`Windows.bat`
复制/剪切到
**go-cqhttp**
文件夹
4.
双击运行
效果如下
```
QQ account:
[QQ账号]
QQ password:
[QQ密码]
enable http?(Y/n)
[是否开启http(y/n),默认开启]
enable ws?(Y/n)
[是否开启websocket(y/n),默认开启]
请按任意键继续. . .
```
5.
双击
`go-cqhttp.exe`
```
[INFO]: 登录成功 欢迎使用: balabala
```
如出现需要认证的信息,请自行认证设备。
此时,基础配置完成
### Linux
#### 标准方法
1.
打开一个命令行/ssh
2.
`cd`
到解压目录
3.
输入
`./go-cqhttp`
,
`Enter`
运行 ,此时将提示
```
[WARNING]: 尝试加载配置文件 config.json 失败: 文件不存在
[INFO]: 默认配置文件已生成,请编辑 config.json 后重启程序.
```
4.
参照
[
config.md
](
https://github.com/Mrs4s/go-cqhttp/blob/master/docs/config.md
)
和你所用到的插件的
`README`
填入参数
5.
再次输入
`./go-cqhttp`
,
`Enter`
运行
```
[INFO]: 登录成功 欢迎使用: balabala
```
如出现需要认证的信息,请自行认证设备。
此时,基础配置完成
#### 懒人法
暂时咕咕咕了
## 验证http是否成功配置
此时,如果在本地开启的服务器,可以在浏览器输入
`http://127.0.0.1:5700/send_private_msg?user_id=[接收者qq号]&message=[发送的信息]`
来发送一条测试信息
如果出现
`{"data":{"message_id":balabala},"retcode":0,"status":"ok"}`
则证明已经成功配置HTTP
# 进阶指南
## 如何自己构建
1.
[
下载源码
](
https://github.com/Mrs4s/go-cqhttp/archive/master.zip
)
并解压 || 使用
`git clone https://github.com/Mrs4s/go-cqhttp.git`
来拉取
2.
[
下载golang binary release
](
https://golang.google.cn/dl/
)
并安装或者
[
自己构建golang
](
https://golang.google.cn/doc/install/source
)
3.
在
`cmd`
或Linux命令行中,
`cd`
到目录中
4.
输入
`go build -ldflags "-s -w -extldflags '-static'"`
,
`Enter`
运行
*注:可以使用*
`go env -w GOPROXY=https://goproxy.cn,direct`
*来加速国内依赖安装速度*
*注:此时构建后的文件名为*
`main`
(Linux)或
`main.exe`
(Windows)
global/config.go
View file @
e386a52f
...
...
@@ -107,7 +107,7 @@ func DefaultConfig() *JsonConfig {
BucketSize
:
1
,
},
PostMessageFormat
:
"string"
,
ForceFragmented
:
tru
e
,
ForceFragmented
:
fals
e
,
HttpConfig
:
&
GoCQHttpConfig
{
Enabled
:
true
,
Host
:
"0.0.0.0"
,
...
...
global/fs.go
View file @
e386a52f
...
...
@@ -53,7 +53,7 @@ func IsAMRorSILK(b []byte) bool {
}
func
FindFile
(
f
,
cache
,
PATH
string
)
(
data
[]
byte
,
err
error
)
{
data
,
err
=
nil
,
errors
.
New
(
"
can't find the file: "
+
f
)
data
,
err
=
nil
,
errors
.
New
(
"
syntax error"
)
if
strings
.
HasPrefix
(
f
,
"http"
)
||
strings
.
HasPrefix
(
f
,
"https"
)
{
if
cache
==
""
{
cache
=
"1"
...
...
@@ -74,7 +74,8 @@ func FindFile(f, cache, PATH string) (data []byte, err error) {
return
nil
,
err
}
}
else
if
strings
.
HasPrefix
(
f
,
"file"
)
{
fu
,
err
:=
url
.
Parse
(
f
)
var
fu
*
url
.
URL
fu
,
err
=
url
.
Parse
(
f
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
go.mod
View file @
e386a52f
...
...
@@ -3,10 +3,10 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-2020
0926101830-afb0ed6368ad
github.com/Mrs4s/MiraiGo v0.0.0-2020
1002092940-afe4132a38d5
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/go-playground/validator/v10 v10.
3
.0 // indirect
github.com/go-playground/validator/v10 v10.
4
.0 // indirect
github.com/gorilla/websocket v1.4.2
github.com/guonaihong/gout v0.1.2
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
...
...
@@ -18,14 +18,14 @@ require (
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/sirupsen/logrus v1.
6
.0
github.com/sirupsen/logrus v1.
7
.0
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/xujiajun/nutsdb v0.5.0
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
golang.org/x/net v0.0.0-202009
04194848-62affa334b73
// indirect
golang.org/x/sys v0.0.0-202009
16084744-dbad9cb7cb7a
// indirect
golang.org/x/net v0.0.0-202009
30145003-4acb6c075d10
// indirect
golang.org/x/sys v0.0.0-202009
30185726-fdedc70b468f
// indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
gopkg.in/yaml.v2 v2.3.0 // indirect
)
go.sum
View file @
e386a52f
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-2020
0921142226-9a449519db5c h1:TpGiSjI8Pe0YLEQPAVkOV37OFLeJnQ6jxvcDSb/LESY
=
github.com/Mrs4s/MiraiGo v0.0.0-2020
0921142226-9a449519db5c
/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-2020
0926101830-afb0ed6368ad h1:m4KU2n3desxr1L3Idk7qRlf71+77rm0JEMWqd4gmrlQ
=
github.com/Mrs4s/MiraiGo v0.0.0-2020
0926101830-afb0ed6368ad
/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-2020
1002083653-383954dc11e2 h1:Pjs3pQKXDxvaWf3zTLmedRl+F1gvcJl+bp3XaYFg4Yw
=
github.com/Mrs4s/MiraiGo v0.0.0-2020
1002083653-383954dc11e2
/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-2020
1002092940-afe4132a38d5 h1:NVXpGL7tssdjYBAsPRvCIL8f8V9e8n9YO8sSsOwdy44
=
github.com/Mrs4s/MiraiGo v0.0.0-2020
1002092940-afe4132a38d5
/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
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=
...
...
@@ -26,8 +26,8 @@ github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEK
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/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.
3.0 h1:nZU+7q+yJoFmwvNgv/LnPUkwPal62+b2xXj0AU1Es7o
=
github.com/go-playground/validator/v10 v10.
3.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/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
...
...
@@ -58,8 +58,6 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
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.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/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.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
...
...
@@ -85,8 +83,8 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.
6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I
=
github.com/sirupsen/logrus v1.
6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88
=
github.com/sirupsen/logrus v1.
7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM
=
github.com/sirupsen/logrus v1.
7.0/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=
...
...
@@ -115,6 +113,7 @@ 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/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/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=
...
...
@@ -126,8 +125,8 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
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-202009
04194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA
=
golang.org/x/net v0.0.0-202009
04194848-62affa334b73
/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-202009
30145003-4acb6c075d10 h1:YfxMZzv3PjGonQYNUaeU2+DhAdqOxerQ30JFB6WgAXo
=
golang.org/x/net v0.0.0-202009
30145003-4acb6c075d10
/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
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=
...
...
@@ -138,12 +137,11 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
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-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-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-20200909081042-eff7692f9009 h1:W0lCpv29Hv0UaM1LXb9QlBHLNP8UFfcKjblhVCWftOM=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200916084744-dbad9cb7cb7a h1:chkwkn8HYWVtTE5DCQNKYlkyptadXYY0+PuyaVdyMo4=
golang.org/x/sys v0.0.0-20200916084744-dbad9cb7cb7a/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.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
...
...
server/apiAdmin.go
View file @
e386a52f
...
...
@@ -155,6 +155,10 @@ func (s *webServer) Dologin() {
if
conf
.
ReLogin
.
Enabled
{
var
times
uint
=
1
for
{
if
cli
.
Online
{
log
.
Warn
(
"Bot已登录"
)
return
}
if
conf
.
ReLogin
.
MaxReloginTimes
==
0
{
}
else
if
times
>
conf
.
ReLogin
.
MaxReloginTimes
{
break
...
...
server/http.go
View file @
e386a52f
...
...
@@ -130,7 +130,9 @@ func (c *httpClient) onBotPushEvent(m coolq.MSG) {
h
[
"X-Signature"
]
=
"sha1="
+
hex
.
EncodeToString
(
mac
.
Sum
(
nil
))
}
return
h
}())
.
SetTimeout
(
time
.
Second
*
time
.
Duration
(
c
.
timeout
))
.
Do
()
}())
.
SetTimeout
(
time
.
Second
*
time
.
Duration
(
c
.
timeout
))
.
F
()
.
Retry
()
.
Attempt
(
5
)
.
WaitTime
(
time
.
Millisecond
*
500
)
.
MaxWaitTime
(
time
.
Second
*
5
)
.
Do
()
if
err
!=
nil
{
log
.
Warnf
(
"上报Event数据 %v 到 %v 失败: %v"
,
m
.
ToJson
(),
c
.
addr
,
err
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment