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
b0e00fe0
Commit
b0e00fe0
authored
Sep 11, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #266.
parent
09aa8523
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-0
main.go
main.go
+23
-0
No files found.
go.mod
View file @
b0e00fe0
...
...
@@ -3,7 +3,7 @@ module github.com/Mrs4s/go-cqhttp
go 1.14
require (
github.com/Mrs4s/MiraiGo v0.0.0-2020091
0013944-236c0f629099
github.com/Mrs4s/MiraiGo v0.0.0-2020091
1100852-71bc19cd42eb
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
...
...
go.sum
View file @
b0e00fe0
...
...
@@ -8,6 +8,8 @@ github.com/Mrs4s/MiraiGo v0.0.0-20200910010455-37409b1f6b9c h1:bhVr3W0+WTVN+vgZG
github.com/Mrs4s/MiraiGo v0.0.0-20200910010455-37409b1f6b9c/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-20200910013944-236c0f629099 h1:b+Tmo9h5leZmQokdUu8c2xSIRkkSYoP1z8G+zcwwyRY=
github.com/Mrs4s/MiraiGo v0.0.0-20200910013944-236c0f629099/go.mod h1:cwYPI2uq6nxNbx0nA6YuAKF1V5szSs6FPlGVLQvRUlo=
github.com/Mrs4s/MiraiGo v0.0.0-20200911100852-71bc19cd42eb h1:WRj/3obehfAMTNKfNo+X3NVqXjeNurMk2yy6haNl/Yk=
github.com/Mrs4s/MiraiGo v0.0.0-20200911100852-71bc19cd42eb/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=
...
...
main.go
View file @
b0e00fe0
...
...
@@ -10,6 +10,7 @@ import (
"image"
"io"
"io/ioutil"
"net"
"os"
"os/signal"
"path"
...
...
@@ -224,6 +225,16 @@ func main() {
log
.
Debug
(
"Protocol -> "
+
e
.
Message
)
}
})
if
global
.
PathExists
(
"servers.bin"
)
{
if
data
,
err
:=
ioutil
.
ReadFile
(
"servers.bin"
);
err
==
nil
{
r
:=
binary
.
NewReader
(
data
)
r
.
ReadUInt16
()
cli
.
CustomServer
=
&
net
.
TCPAddr
{
IP
:
r
.
ReadBytes
(
4
),
Port
:
int
(
r
.
ReadUInt16
()),
}
}
}
rsp
,
err
:=
cli
.
Login
()
for
{
global
.
Check
(
err
)
...
...
@@ -284,6 +295,18 @@ func main() {
}
log
.
Info
(
"资源初始化完成, 开始处理信息."
)
log
.
Info
(
"アトリは、高性能ですから!"
)
cli
.
OnServerUpdated
(
func
(
bot
*
client
.
QQClient
,
e
*
client
.
ServerUpdatedEvent
)
{
log
.
Infof
(
"收到服务器地址更新通知, 将在下一次重连时应用. 服务器地址: %v:%v 服务器位置: %v"
,
e
.
Servers
[
0
]
.
Server
,
e
.
Servers
[
0
]
.
Port
,
e
.
Servers
[
0
]
.
Location
)
_
=
ioutil
.
WriteFile
(
"servers.bin"
,
binary
.
NewWriterF
(
func
(
w
*
binary
.
Writer
)
{
w
.
WriteUInt16
(
uint16
(
len
(
e
.
Servers
)))
for
_
,
s
:=
range
e
.
Servers
{
if
!
strings
.
Contains
(
s
.
Server
,
"com"
)
{
w
.
Write
(
net
.
ParseIP
(
s
.
Server
))
w
.
WriteUInt16
(
uint16
(
s
.
Port
))
}
}
}),
0644
)
})
cli
.
OnDisconnected
(
func
(
bot
*
client
.
QQClient
,
e
*
client
.
ClientDisconnectedEvent
)
{
if
conf
.
ReLogin
.
Enabled
{
var
times
uint
=
1
...
...
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