Utils.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:MantaroRPG 作者:
public static String paste(String toSend) {
    try {
        String pasteToken = Unirest.post("https://hastebin.com/documents")
            .header("User-Agent", "Mantaro")
            .header("Content-Type", "text/plain")
            .body(toSend)
            .asJson()
            .getBody()
            .getObject()
            .getString("key");
        return "https://hastebin.com/" + pasteToken;
    } catch (UnirestException e) {
        log.warn("Hastebin is being funny, huh? Cannot send or retrieve paste.", e);
        return "Bot threw ``" + e.getClass().getSimpleName() + "``" + " while trying to upload paste, check logs";
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号