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"); }