Skip to content

Commit

Permalink
fix: 🔇 remove kook websocket debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
AnzhiZhang committed Dec 22, 2022
1 parent 11ec137 commit 01799b8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/com/zhanganzhi/chathub/receiver/KookReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ private void sleep(long millis) {

private void handleMessage(String text) {
JSONObject signaling = JSON.parseObject(text);
logger.info("Kook websocket message received: " + signaling.toJSONString(JSONWriter.Feature.PrettyFormat));
// 信令
int type = signaling.getInteger("s");
if (type == 0) {
Expand All @@ -83,13 +82,13 @@ private void handleMessage(String text) {
// read data
JSONObject eventData = signaling.getJSONObject("d");

// ignore bot message
if (eventData.getJSONObject("extra").getJSONObject("author").getBoolean("bot")) {
return;
}

// Type 9: KMarkdown
if (eventData.getInteger("type") == 9) {
// ignore bot message
if (eventData.getJSONObject("extra").getJSONObject("author").getBoolean("bot")) {
return;
}

// check channel
if (eventData.getString("channel_type").equals("GROUP") && eventData.getString("target_id").equals(Config.getInstance().getKookChannelId())) {
if (eventData.getString("content").equals("/list")) {
Expand All @@ -108,7 +107,6 @@ private void handleMessage(String text) {
() -> {
websocket.send("{\"s\":2,\"sn\":" + sn + "}");
pingFinished = false;
logger.info("Kook websocket ping sent, sn=" + sn);

// check pong in 6 seconds
sleep(6000);
Expand Down

0 comments on commit 01799b8

Please sign in to comment.