Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guimc233 committed Jul 6, 2024
1 parent f681d50 commit 52ef718
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/kotlin/ltd/guimc/plugin/quotly/QuotLyCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ object QuotLyCommand: SimpleCommand(

var member = subject.cast<Group>().getOrFail(quote.source.fromId)

val postValue = JSONObject(
val postValue =
" {\n" +
" \"type\": \"quote\",\n" +
" \"format\": \"png\",\n" +
Expand All @@ -81,14 +81,17 @@ object QuotLyCommand: SimpleCommand(
" \"url\": \"${member.avatarUrl}\"\n" +
" }\n" +
" },\n" +
" \"text\": \"${textMessage.replace("\n", "\\\\n").replace("\r", "\\\\r")}\",\n" +
" \"text\": \"${textMessage.replace("\\n", "\\\\n")
.replace("\n", "\\n")
.replace("\\r", "\\\\r")
.replace("\r", "\\r")}\",\n" +
" }\n" +
" ]\n" +
" }")
" }"

cooldown.flag(user!!)
try {
val rawResp = JSONObject(HttpUtil.post("http://127.0.0.1:3000/generate", postValue.toString()))
val rawResp = JSONObject(HttpUtil.post("http://127.0.0.1:3000/generate", postValue))
val resp = rawResp.getJSONObject("result").getString("image")
if (!OverflowUtils.checkOverflowCore()) {
sendMessage(ImageUtils.base642imageMessage(resp, bot!!, subject!!))
Expand Down

0 comments on commit 52ef718

Please sign in to comment.