From 07f111a6e7cd18fa0c6210599aafe489f5ef7fd3 Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Sun, 16 Jan 2022 09:47:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20nbnhhsh=20=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=AF=B9=20[inputting]"=E5=8F=AF=E8=83=BD=E7=9A=84"?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../sukazyo/cono/morny/GradleProjectConfigures.java | 4 ++-- .../cono/morny/bot/event/on_commands/Nbnhhsh.java | 13 +++++++++++-- .../cc/sukazyo/cono/morny/data/NbnhhshQuery.java | 1 + 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0e8762b..26864bd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.4.3.4 +VERSION = 0.4.3.5 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index a927157..1b20bb4 100644 --- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java +++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java @@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny; * the final field that will be updated by gradle automatically. */ public class GradleProjectConfigures { - public static final String VERSION = "0.4.3.4"; - public static final long COMPILE_TIMESTAMP = 1642273245554L; + public static final String VERSION = "0.4.3.5"; + public static final long COMPILE_TIMESTAMP = 1642297552612L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/event/on_commands/Nbnhhsh.java b/src/main/java/cc/sukazyo/cono/morny/bot/event/on_commands/Nbnhhsh.java index 8cf4649..7dd130e 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/event/on_commands/Nbnhhsh.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/event/on_commands/Nbnhhsh.java @@ -28,11 +28,20 @@ public class Nbnhhsh { StringBuilder message = new StringBuilder("## Result of nbnhhsh query :"); for (NbnhhshQuery.Word word : response.words) { - if (word.trans == null) continue; + if (word.trans != null && word.trans.length == 0) word.trans = null; + if (word.inputting != null && word.inputting.length == 0) word.inputting = null; + if (word.trans == null && word.inputting == null) continue; message.append("\n\n[[ ").append(escapeHtml(word.name)).append(" ]]"); - for (String trans : word.trans) { + if (word.trans != null) for (String trans : word.trans) { message.append("\n* ").append(escapeHtml(trans)).append(""); } + if (word.inputting != null) { + if (word.trans != null) message.append("\n"); + message.append(" maybe:"); + for (String trans : word.inputting) { + message.append("\n` ").append(escapeHtml(trans)).append(""); + } + } } MornyCoeur.extra().exec(new SendMessage( diff --git a/src/main/java/cc/sukazyo/cono/morny/data/NbnhhshQuery.java b/src/main/java/cc/sukazyo/cono/morny/data/NbnhhshQuery.java index 27c5932..90119aa 100644 --- a/src/main/java/cc/sukazyo/cono/morny/data/NbnhhshQuery.java +++ b/src/main/java/cc/sukazyo/cono/morny/data/NbnhhshQuery.java @@ -16,6 +16,7 @@ public class NbnhhshQuery { public static class Word { public String name; public String[] trans; + public String[] inputting; } public static class GuessResult {