修复过时消息抑制的bug,添加 tgapi-5.4.0 新事件,修订 javadoc,修订一个log的信息,gradle.properties

- 项目的版本数据现在由 gradle.properties 管理
- 修复 outdated-block 的实现中单位计算出现错误导致的全部消息都会被阻止的问题
- EventAPI 添加 ChatJoinRequest 事件支持
- 更改 TrackerDataManager 守护线程的关机清理的消息和优先级
- 修订 MornyCoeur 类 javadoc 换行,删除 ServerMain javadoc无用信息
This commit is contained in:
A.C.Sukazyo Eyre 2021-12-10 01:08:18 +08:00
parent 4bb634c3f3
commit dc332de50c
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
10 changed files with 31 additions and 17 deletions

View File

@ -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}"
}

11
gradle.properties Normal file
View File

@ -0,0 +1,11 @@
## Core
VERSION = 0.4.1.0
# dependencies
libSpotbugsVersion = 4.5.0
libJavaTelegramBotApiVersion = 5.5.0
libJunitVersion = 5.8.2

View File

@ -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;
}

View File

@ -13,7 +13,6 @@ import static cc.sukazyo.cono.morny.Logger.logger;
/**
* Morny Cono 核心<br>
* <br>
* - 的程序化入口类保管着 morny 的核心属性<br>
*/
public class MornyCoeur {

View File

@ -13,13 +13,6 @@ import static cc.sukazyo.cono.morny.Logger.logger;
* 程序启动入口<br>
* <br>
* 会处理程序传入的参数和选项等数据并执行对应的启动方式<br>
* <br>
* - 第一个参数({@code args[0]})必序传递值为 telegram-bot api-token<br>
* - 第二个参数可选 {@code --no-hello} {@code --only-hello}
* 前者表示不输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}
* 后者表示只输出{@link MornyHello#MORNY_PREVIEW_IMAGE_ASCII 欢迎标语}而不运行程序逻辑<br>
* <br>
* 或者在第一个参数处使用 {@code --version} 来输出当前程序的版本信息
*
* @since 0.4.0.0
*/

View File

@ -59,4 +59,8 @@ public abstract class EventListener {
return false;
}
public boolean onChatJoinRequest (@Nonnull Update update) {
return false;
}
}

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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.");