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
30c4d508
Commit
30c4d508
authored
Sep 11, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix panic.
parent
b0e00fe0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
main.go
main.go
+13
-13
No files found.
main.go
View file @
30c4d508
...
@@ -225,12 +225,24 @@ func main() {
...
@@ -225,12 +225,24 @@ func main() {
log
.
Debug
(
"Protocol -> "
+
e
.
Message
)
log
.
Debug
(
"Protocol -> "
+
e
.
Message
)
}
}
})
})
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
.
WriteString
(
s
.
Server
)
w
.
WriteUInt16
(
uint16
(
s
.
Port
))
}
}
}),
0644
)
})
if
global
.
PathExists
(
"servers.bin"
)
{
if
global
.
PathExists
(
"servers.bin"
)
{
if
data
,
err
:=
ioutil
.
ReadFile
(
"servers.bin"
);
err
==
nil
{
if
data
,
err
:=
ioutil
.
ReadFile
(
"servers.bin"
);
err
==
nil
{
r
:=
binary
.
NewReader
(
data
)
r
:=
binary
.
NewReader
(
data
)
r
.
ReadUInt16
()
r
.
ReadUInt16
()
cli
.
CustomServer
=
&
net
.
TCPAddr
{
cli
.
CustomServer
=
&
net
.
TCPAddr
{
IP
:
r
.
ReadBytes
(
4
),
IP
:
net
.
ParseIP
(
r
.
ReadString
()
),
Port
:
int
(
r
.
ReadUInt16
()),
Port
:
int
(
r
.
ReadUInt16
()),
}
}
}
}
...
@@ -295,18 +307,6 @@ func main() {
...
@@ -295,18 +307,6 @@ func main() {
}
}
log
.
Info
(
"资源初始化完成, 开始处理信息."
)
log
.
Info
(
"资源初始化完成, 开始处理信息."
)
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
)
{
cli
.
OnDisconnected
(
func
(
bot
*
client
.
QQClient
,
e
*
client
.
ClientDisconnectedEvent
)
{
if
conf
.
ReLogin
.
Enabled
{
if
conf
.
ReLogin
.
Enabled
{
var
times
uint
=
1
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