diff --git a/gradle.properties b/gradle.properties
index 96a7c65..ad6e88f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,12 +1,12 @@
## Core
-VERSION = 0.4.1.2
+VERSION = 0.4.1.3
# dependencies
libSpotbugsVersion = 4.5.0
-libMessivaVersion = 0.1.0.0
+libMessivaVersion = 0.1.0.1
libJavaTelegramBotApiVersion = 5.5.0
diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java
index 305a77b..9000285 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.1.2";
- public static final long COMPILE_TIMESTAMP = 1639211288142L;
+ public static final String VERSION = "0.4.1.3";
+ public static final long COMPILE_TIMESTAMP = 1639476313268L;
}
diff --git a/src/main/java/cc/sukazyo/cono/morny/Log.java b/src/main/java/cc/sukazyo/cono/morny/Log.java
index 7109fcb..b58c825 100644
--- a/src/main/java/cc/sukazyo/cono/morny/Log.java
+++ b/src/main/java/cc/sukazyo/cono/morny/Log.java
@@ -4,11 +4,15 @@ import cc.sukazyo.messiva.Logger;
import cc.sukazyo.messiva.appender.ConsoleAppender;
/**
- * Morny 的简单控制台 log 记录器
+ * Morny 的 log 管理器
*/
public class Log {
- /** Morny 的 Logger 实例 */
+ /**
+ * Morny 的 Logger 实例,
+ * messiva 更新
+ * @since 0.4.1.1
+ */
public static final Logger logger = new Logger(new ConsoleAppender());
}
diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/event/EventListeners.java b/src/main/java/cc/sukazyo/cono/morny/bot/event/EventListeners.java
index 8bb693b..a08e3fe 100644
--- a/src/main/java/cc/sukazyo/cono/morny/bot/event/EventListeners.java
+++ b/src/main/java/cc/sukazyo/cono/morny/bot/event/EventListeners.java
@@ -8,13 +8,15 @@ public class EventListeners {
public static final OnActivityRecord ACTIVITY_RECORDER = new OnActivityRecord();
public static final OnUserSlashAction USER_SLASH_ACTION = new OnUserSlashAction();
public static final OnUpdateTimestampOffsetLock UPDATE_TIMESTAMP_OFFSET_LOCK = new OnUpdateTimestampOffsetLock();
+ public static final OnInlineQuery INLINE_QUERY = new OnInlineQuery();
public static void registerAllListeners () {
EventListenerManager.addListener(
ACTIVITY_RECORDER,
UPDATE_TIMESTAMP_OFFSET_LOCK,
COMMANDS_LISTENER,
- USER_SLASH_ACTION
+ USER_SLASH_ACTION,
+ INLINE_QUERY
);
}
diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/event/OnInlineQuery.java b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnInlineQuery.java
new file mode 100644
index 0000000..6bf189e
--- /dev/null
+++ b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnInlineQuery.java
@@ -0,0 +1,33 @@
+package cc.sukazyo.cono.morny.bot.event;
+
+import cc.sukazyo.cono.morny.MornyCoeur;
+import cc.sukazyo.cono.morny.bot.api.EventListener;
+import cc.sukazyo.cono.morny.util.EncryptUtils;
+import com.pengrad.telegrambot.model.Update;
+import com.pengrad.telegrambot.model.request.InlineQueryResultArticle;
+import com.pengrad.telegrambot.model.request.InputTextMessageContent;
+import com.pengrad.telegrambot.model.request.ParseMode;
+import com.pengrad.telegrambot.request.AnswerInlineQuery;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @since 0.4.1.3
+ */
+public class OnInlineQuery extends EventListener {
+
+ /**
+ * @since 0.4.1.3
+ */
+ @Override
+ public boolean onInlineQuery (@NotNull Update update) {
+ MornyCoeur.getAccount().execute(new AnswerInlineQuery(update.inlineQuery().id(), new InlineQueryResultArticle[]{
+ new InlineQueryResultArticle(
+ EncryptUtils.encryptByMD5(update.inlineQuery().query()),
+ "Raw Input",
+ new InputTextMessageContent(update.inlineQuery().query()).parseMode(ParseMode.MarkdownV2)
+ )
+ }));
+ return true;
+ }
+
+}
diff --git a/src/main/java/cc/sukazyo/cono/morny/util/EncryptUtils.java b/src/main/java/cc/sukazyo/cono/morny/util/EncryptUtils.java
new file mode 100644
index 0000000..6d502f9
--- /dev/null
+++ b/src/main/java/cc/sukazyo/cono/morny/util/EncryptUtils.java
@@ -0,0 +1,61 @@
+package cc.sukazyo.cono.morny.util;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * 用于数据加密或编码的工具类
+ * 显然大部分代码是抄来的
+ *