Skip to content

Commit

Permalink
fix pretty json
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Mar 9, 2024
1 parent 2db2baa commit 2d54df9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions onebot/src/main/java/cn/evole/onebot/sdk/util/JsonHelper.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package cn.evole.onebot.sdk.util;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.*;

import java.util.function.Supplier;

public abstract class JsonHelper {
public static final Gson gson = new Gson();
public static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
public static int ignorable(JsonObject obj, String key, int def) {
JsonElement element = obj.get(key);
if (element == null || !element.isJsonPrimitive()) return def;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package top.mrxiaom.overflow.internal

import cn.evole.onebot.sdk.action.ActionRaw
import cn.evole.onebot.sdk.response.contact.FriendInfoResp
import cn.evole.onebot.sdk.util.JsonHelper.gson
import cn.evolvefield.onebot.client.config.BotConfig
import cn.evolvefield.onebot.client.connection.ConnectFactory
import kotlinx.coroutines.CoroutineName
Expand Down Expand Up @@ -230,7 +231,7 @@ class Overflow : IMirai, CoroutineScope, LowLevelApiAccessor, OverflowAPI {
}
val versionInfo = botImpl.getVersionInfo()
if (printInfo) {
logger.info("服务端版本信息\n${versionInfo.toPrettyString()}")
logger.info("服务端版本信息\n${gson.toJson(versionInfo)}")
}
val bot = botImpl.wrap()

Expand Down

0 comments on commit 2d54df9

Please sign in to comment.