From 9f9b9fbfa5f7f8cb0a1889dc72287e1eadef071c Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Sat, 2 Apr 2022 17:12:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84=E4=B8=80=E4=B8=AA=20typo=20bug?= 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/command/DirectMsgClear.java | 12 +++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 045c096..23d4136 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.7.0.3 +VERSION = 0.7.0.4 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index da0d29d..d94b461 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.7.0.3"; - public static final long COMPILE_TIMESTAMP = 1648803402848L; + public static final String VERSION = "0.7.0.4"; + public static final long COMPILE_TIMESTAMP = 1648890683777L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.java b/src/main/java/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.java index dc9372f..7e3cc82 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/command/DirectMsgClear.java @@ -10,6 +10,8 @@ import com.pengrad.telegrambot.request.GetChatMember; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import static cc.sukazyo.cono.morny.Log.logger; + public class DirectMsgClear implements ISimpleCommand { @Nonnull @Override public String getName () { return "/r"; } @@ -19,11 +21,15 @@ public class DirectMsgClear implements ISimpleCommand { @Override public void execute (@Nonnull InputCommand command, @Nonnull Update event) { + logger.debug("Executing command /r"); if (event.message().replyToMessage() == null) return; + logger.trace("Message is a reply"); if (event.message().replyToMessage().from().id() != MornyCoeur.getUserid()) return; - if (event.message().replyToMessage().date() - System.currentTimeMillis()/1000 < 48*60*60) return; + logger.trace("Message is from me"); + if (System.currentTimeMillis()/1000 - event.message().replyToMessage().date() > 48*60*60) return; + logger.trace("Message is not older than 48 hours"); - final boolean isTrusted = MornyCoeur.trustedInstance().isTrusted(event.message().chat().id()); + final boolean isTrusted = MornyCoeur.trustedInstance().isTrusted(event.message().from().id()); if ( isTrusted || ( @@ -45,7 +51,7 @@ public class DirectMsgClear implements ISimpleCommand { )); } - } + } else logger.trace("User is not trusted"); }