diff --git a/gradle.properties b/gradle.properties index 22b2091..798df0e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s -VERSION = 1.0.0-RC1 +VERSION = 1.0.0-RC1.1 USE_DELTA = false VERSION_DELTA = diff --git a/src/main/java/cc/sukazyo/cono/morny/daemon/MornyReport.java b/src/main/java/cc/sukazyo/cono/morny/daemon/MornyReport.java index b4f7ae5..0aa990e 100644 --- a/src/main/java/cc/sukazyo/cono/morny/daemon/MornyReport.java +++ b/src/main/java/cc/sukazyo/cono/morny/daemon/MornyReport.java @@ -21,8 +21,12 @@ import static cc.sukazyo.cono.morny.util.tgapi.formatting.MsgEscape.escapeHtml; public class MornyReport { + private static boolean unsupported () { + return !MornyCoeur.available() || MornyCoeur.config().reportToChat == -1; + } + private static , R extends BaseResponse> void executeReport (@Nonnull T report) { - if (!MornyCoeur.available()) return; + if (unsupported()) return; try { MornyCoeur.extra().exec(report); } catch (EventRuntimeException.ActionFailed e) { @@ -34,7 +38,7 @@ public class MornyReport { } public static void exception (@Nonnull Exception e, @Nullable String description) { - if (!MornyCoeur.available()) return; + if (unsupported()) return; executeReport(new SendMessage( MornyCoeur.config().reportToChat, String.format(""" @@ -55,7 +59,7 @@ public class MornyReport { public static void exception (@Nonnull Exception e) { exception(e, null); } public static void unauthenticatedAction (@Nonnull String action, @Nonnull User user) { - if (!MornyCoeur.available()) return; + if (unsupported()) return; executeReport(new SendMessage( MornyCoeur.config().reportToChat, String.format(""" @@ -131,7 +135,7 @@ public class MornyReport { * 传入 {@link null} 则表示不表明原因。 */ static void onMornyExit (@Nullable Object causedBy) { - if (!MornyCoeur.available()) return; + if (unsupported()) return; String causedTag = null; if (causedBy != null) { if (causedBy instanceof User)