diff --git a/build.gradle b/build.gradle index 50aeb34..7c3c566 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group 'cc.sukazyo' -version '0.4.0.1' +version VERSION project.ext.archiveBaseName = 'Coeur_Morny_Cono' project.ext.artifactId = 'morny-coeur' mainClassName = 'cc.sukazyo.cono.morny.ServerMain' @@ -18,12 +18,12 @@ repositories { dependencies { - compileOnlyApi "com.github.spotbugs:spotbugs-annotations:4.5.0" + compileOnlyApi "com.github.spotbugs:spotbugs-annotations:${libSpotbugsVersion}" - implementation 'com.github.pengrad:java-telegram-bot-api:5.4.0' + implementation "com.github.pengrad:java-telegram-bot-api:${libJavaTelegramBotApiVersion}" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + testImplementation "org.junit.jupiter:junit-jupiter-api:${libJunitVersion}" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${libJunitVersion}" } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..7d6499a --- /dev/null +++ b/gradle.properties @@ -0,0 +1,11 @@ +## Core + +VERSION = 0.4.1.0 + +# dependencies + +libSpotbugsVersion = 4.5.0 + +libJavaTelegramBotApiVersion = 5.5.0 + +libJunitVersion = 5.8.2 diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index da12eb9..5b74266 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.0.1"; - public static final long COMPILE_TIMESTAMP = 1638938903400L; + public static final String VERSION = "0.4.1.0"; + public static final long COMPILE_TIMESTAMP = 1639069681128L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java b/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java index 4dc90bf..e611353 100644 --- a/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java +++ b/src/main/java/cc/sukazyo/cono/morny/MornyCoeur.java @@ -13,7 +13,6 @@ import static cc.sukazyo.cono.morny.Logger.logger; /** * Morny Cono 核心
- *
* - 的程序化入口类,保管着 morny 的核心属性
*/ public class MornyCoeur { diff --git a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java index 49074d0..f18487d 100644 --- a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java +++ b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java @@ -13,13 +13,6 @@ import static cc.sukazyo.cono.morny.Logger.logger; * 程序启动入口
*
* 会处理程序传入的参数和选项等数据,并执行对应的启动方式
- *
- * - 第一个参数({@code args[0]})必序传递,值为 telegram-bot 的 api-token
- * - 第二个参数可选 {@code --no-hello} 和 {@code --only-hello}, - * 前者表示不输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}, - * 后者表示只输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}而不运行程序逻辑
- *
- * 或者,在第一个参数处使用 {@code --version} 来输出当前程序的版本信息 * * @since 0.4.0.0 */ diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListener.java b/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListener.java index 73e4c1a..a7c8c5e 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListener.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListener.java @@ -59,4 +59,8 @@ public abstract class EventListener { return false; } + public boolean onChatJoinRequest (@Nonnull Update update) { + return false; + } + } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListenerManager.java b/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListenerManager.java index 5ac91a6..483b492 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListenerManager.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/api/EventListenerManager.java @@ -93,4 +93,8 @@ public class EventListenerManager { new EventPublisher(update, x -> x.onChatMemberUpdated(update)).start(); } + public static void publishChatJoinRequestEvent (@Nonnull Update update) { + new EventPublisher(update, x -> x.onChatJoinRequest(update)).start(); + } + } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/api/OnUpdate.java b/src/main/java/cc/sukazyo/cono/morny/bot/api/OnUpdate.java index 8427283..e03653b 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/api/OnUpdate.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/api/OnUpdate.java @@ -49,6 +49,9 @@ public class OnUpdate { if (update.chatMember() != null) { EventListenerManager.publishChatMemberUpdatedEvent(update); } + if (update.chatJoinRequest() != null) { + EventListenerManager.publishChatJoinRequestEvent(update); + } } return UpdatesListener.CONFIRMED_UPDATES_ALL; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUpdateTimestampOffsetLock.java b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUpdateTimestampOffsetLock.java index 2ad2fd4..7130277 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUpdateTimestampOffsetLock.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUpdateTimestampOffsetLock.java @@ -9,7 +9,7 @@ public class OnUpdateTimestampOffsetLock extends EventListener { @Override public boolean onMessage (@NotNull Update update) { - return update.message().date() < MornyCoeur.latestEventTimestamp*1000; + return update.message().date() < MornyCoeur.latestEventTimestamp/1000; } } diff --git a/src/main/java/cc/sukazyo/cono/morny/data/tracker/TrackerDataManager.java b/src/main/java/cc/sukazyo/cono/morny/data/tracker/TrackerDataManager.java index 1695a24..048df3c 100644 --- a/src/main/java/cc/sukazyo/cono/morny/data/tracker/TrackerDataManager.java +++ b/src/main/java/cc/sukazyo/cono/morny/data/tracker/TrackerDataManager.java @@ -40,7 +40,7 @@ public class TrackerDataManager { } if (interrupted()) { postProcess = true; - logger.warn("last tracker write in this processor!"); + logger.info("CALLED TO EXIT! writing cache."); } if (record.size() != 0) { logger.info("start writing tracker data.");