Uh oh!
There was an error while loading. Please reload this page.
forked from Kloping/qqpd-bot-java
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_onError.java
More file actions
Latest commit
36 lines (31 loc) · 1.09 KB
/
Copy pathtest_onError.java
File metadata and controls
36 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
importio.github.kloping.qqbot.Starter;
importio.github.kloping.qqbot.api.Intents;
importio.github.kloping.qqbot.network.AuthAndHeartbeat;
importio.github.kloping.qqbot.network.WebSocketListener;
importio.github.kloping.spt.annotations.AutoStand;
importorg.java_websocket.client.WebSocketClient;
/**
* 将 wss error 加入重连
* @author github.kloping
*/
publicclasstest_onErrorimplementsWebSocketListener {
@AutoStand
AuthAndHeartbeatauthAndHeartbeat;
@AutoStand
Starterstarter;
@Override
publicbooleanonError(WebSocketClientclient, Exceptione) {
//尝试重连
authAndHeartbeat.identifyConnect(0, client);
returnWebSocketListener.super.onError(client, e);
}
publicstaticvoidmain(String[] args) throwsException {
Starterstarter = newStarter("xxx", "xxx");
starter.getConfig().setCode(Intents.PRIVATE_INTENTS.getCode());
//设置websocket 监听
starter.getConfig().setWebSocketListener(newtest_onError());
//切换沙盒
starter.getConfig().sandbox();
starter.run();
}
}