From d4fcfd9d6779a0cf6967540bb86774aae91355bb Mon Sep 17 00:00:00 2001 From: areteruhiro <108941410+areteruhiro@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:10:24 +0900 Subject: [PATCH] Update EmbedOptions.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit リストアの際の重複がしないように改良 --- .../chipppppppppp/lime/hooks/EmbedOptions.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/github/chipppppppppp/lime/hooks/EmbedOptions.java b/app/src/main/java/io/github/chipppppppppp/lime/hooks/EmbedOptions.java index 2ac291d..d08a402 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/hooks/EmbedOptions.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/hooks/EmbedOptions.java @@ -580,10 +580,19 @@ public class EmbedOptions implements IHook { String parameter = cursor.getString(cursor.getColumnIndex("parameter")); byte[] chunks = cursor.getBlob(cursor.getColumnIndex("chunks")); - // server_idがnullの場合はスキップ - if (serverId == null) { - continue; - } + if (serverId == null) { + continue; + } + + + Cursor existingCursor = originalDb.rawQuery("SELECT 1 FROM chat_history WHERE server_id = ?", new String[]{serverId}); + boolean recordExists = existingCursor.moveToFirst(); + existingCursor.close(); + + if (recordExists) { + continue; + } + // ContentValuesを使用してデータを挿入 ContentValues values = new ContentValues();