mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-12-05 01:16:51 +08:00
版本信息与编译信息添加时间戳记录
This commit is contained in:
parent
2ba05b2a81
commit
ad3b8b38f3
@ -7,7 +7,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'cc.sukazyo'
|
||||
version '0.3.4.2'
|
||||
version '0.3.4.3'
|
||||
project.ext.archiveBaseName = 'Coeur_Morny_Cono'
|
||||
project.ext.artifactId = 'morny-coeur'
|
||||
mainClassName = 'cc.sukazyo.cono.morny.MornyCoeur'
|
||||
@ -31,6 +31,9 @@ task updateVersionCode {
|
||||
ant.replaceregexp(match:'VERSION = ["a-zA-Z0-9.\\-_+@]+;', replace:"VERSION = \"$project.version\";", flags:'g', byline:true) {
|
||||
fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java')
|
||||
}
|
||||
ant.replaceregexp(match:'COMPILE_TIMESTAMP = [0-9]+L;', replace:"COMPILE_TIMESTAMP = ${System.currentTimeMillis()}L;", flags:'g', byline:true) {
|
||||
fileset(dir: 'src/main/java/cc/sukazyo/cono/morny', includes: 'GradleProjectConfigures.java')
|
||||
}
|
||||
}
|
||||
|
||||
compileJava.dependsOn updateVersionCode
|
||||
|
@ -5,4 +5,5 @@ package cc.sukazyo.cono.morny;
|
||||
*/
|
||||
public class GradleProjectConfigures {
|
||||
public static final String VERSION = "0.3.4.2";
|
||||
public static final long COMPILE_TIMESTAMP = 1638848971137L;
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ import com.pengrad.telegrambot.request.GetMe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static cc.sukazyo.cono.morny.Logger.logger;
|
||||
|
||||
/**
|
||||
@ -45,9 +51,19 @@ public class MornyCoeur {
|
||||
if ("--version".equals(args[0])) {
|
||||
logger.info(String.format("""
|
||||
Morny Cono Version
|
||||
- version : %s
|
||||
- md5hash : %s
|
||||
""", MornySystem.VERSION, MornySystem.getJarMd5()
|
||||
- version :
|
||||
%s
|
||||
- md5hash :
|
||||
%s
|
||||
- co.time :
|
||||
%d
|
||||
%s [UTC]""",
|
||||
MornySystem.VERSION,
|
||||
MornySystem.getJarMd5(),
|
||||
GradleProjectConfigures.COMPILE_TIMESTAMP,
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss:SSS").format(LocalDateTime.ofInstant(
|
||||
Instant.ofEpochMilli(GradleProjectConfigures.COMPILE_TIMESTAMP),
|
||||
ZoneId.ofOffset("UTC", ZoneOffset.UTC)))
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cc.sukazyo.cono.morny.bot.event;
|
||||
|
||||
import cc.sukazyo.cono.morny.GradleProjectConfigures;
|
||||
import cc.sukazyo.cono.morny.MornyCoeur;
|
||||
import cc.sukazyo.cono.morny.MornySystem;
|
||||
import cc.sukazyo.cono.morny.MornyTrusted;
|
||||
@ -13,6 +14,12 @@ import com.pengrad.telegrambot.request.SendSticker;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import static cc.sukazyo.cono.morny.Logger.logger;
|
||||
|
||||
public class OnCommandExecute extends EventListener {
|
||||
@ -96,13 +103,20 @@ public class OnCommandExecute extends EventListener {
|
||||
private void onCommandVersionExec (@Nonnull Update event) {
|
||||
MornyCoeur.getAccount().execute(new SendMessage(
|
||||
event.message().chat().id(),
|
||||
String.format(
|
||||
"version:\n" +
|
||||
"\t<code>%s</code>\n" +
|
||||
"core md5_hash:\n" +
|
||||
"\t<code>%s</code>",
|
||||
String.format("""
|
||||
version:
|
||||
<code> </code><code>%s</code>
|
||||
core md5_hash:
|
||||
<code> </code><code>%s</code>
|
||||
compile timestamp:
|
||||
<code> </code><code>%d</code>
|
||||
<code> </code><code>%s [UTC]</code>""",
|
||||
MornySystem.VERSION,
|
||||
MornySystem.getJarMd5()
|
||||
MornySystem.getJarMd5(),
|
||||
GradleProjectConfigures.COMPILE_TIMESTAMP,
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss:SSS").format(LocalDateTime.ofInstant(
|
||||
Instant.ofEpochMilli(GradleProjectConfigures.COMPILE_TIMESTAMP),
|
||||
ZoneId.ofOffset("UTC", ZoneOffset.UTC)))
|
||||
)
|
||||
).replyToMessageId(event.message().messageId()).parseMode(ParseMode.HTML));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user