From 8f2c63e3003b36ae1a660f1626cfdc550c07f48c Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Fri, 21 Jan 2022 14:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=81=9C=E6=96=9C=E7=BA=BF=E5=8A=A8?= =?UTF-8?q?=E4=BD=9C=E5=9C=A8=20.DP7=20=E7=9B=B8=E5=85=B3=E7=BE=A4?= =?UTF-8?q?=E7=BB=84=E8=BF=90=E4=BD=9C=20@Lapis-Apple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../cono/morny/GradleProjectConfigures.java | 4 ++-- .../cono/morny/bot/event/OnUserSlashAction.java | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 26864bd..91778ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ ## Core -VERSION = 0.4.3.5 +VERSION = 0.4.3.6 # dependencies diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java index 1b20bb4..9710257 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.3.5"; - public static final long COMPILE_TIMESTAMP = 1642297552612L; + public static final String VERSION = "0.4.3.6"; + public static final long COMPILE_TIMESTAMP = 1642747921571L; } diff --git a/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.java b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.java index d220b4c..317ccce 100644 --- a/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.java +++ b/src/main/java/cc/sukazyo/cono/morny/bot/event/OnUserSlashAction.java @@ -12,6 +12,7 @@ import com.pengrad.telegrambot.request.SendMessage; import javax.annotation.Nonnull; +import static cc.sukazyo.cono.morny.Log.logger; import static cc.sukazyo.untitled.util.telegram.formatting.MsgEscape.escapeHtml; public class OnUserSlashAction extends EventListener { @@ -21,6 +22,20 @@ public class OnUserSlashAction extends EventListener { final String text = event.message().text(); if (text == null) return false; + // Due to @Lapis_Apple, we stopped slash action function at .DP7 groups. + // It may be enabled after some of updates when the function will not be conflicted to other bots. + // if (event.message().chat().id() == ) return false; + if (event.message().chat().title() != null && event.message().chat().title().contains(".DP7")) { + logger.info(String.format(""" + Chat slash action ignored due to keyword \".DP7\". + - %s + - [%d]""", + event.message().chat().title(), + event.message().chat().id() + )); + return false; + } + if (text.startsWith("/")) { int prefixLength = 1; boolean useVerbSuffix = true;