mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono.git
synced 2024-11-22 19:24:53 +08:00
修复未预见 --report-to 设置为 -1 的问题
This commit is contained in:
parent
a863570be2
commit
a83930efd0
@ -5,7 +5,7 @@ MORNY_ARCHIVE_NAME = morny-coeur
|
|||||||
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
MORNY_CODE_STORE = https://github.com/Eyre-S/Coeur-Morny-Cono
|
||||||
MORNY_COMMIT_PATH = https://github.com/Eyre-S/Coeur-Morny-Cono/commit/%s
|
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
|
USE_DELTA = false
|
||||||
VERSION_DELTA =
|
VERSION_DELTA =
|
||||||
|
@ -21,8 +21,12 @@ import static cc.sukazyo.cono.morny.util.tgapi.formatting.MsgEscape.escapeHtml;
|
|||||||
|
|
||||||
public class MornyReport {
|
public class MornyReport {
|
||||||
|
|
||||||
|
private static boolean unsupported () {
|
||||||
|
return !MornyCoeur.available() || MornyCoeur.config().reportToChat == -1;
|
||||||
|
}
|
||||||
|
|
||||||
private static <T extends BaseRequest<T, R>, R extends BaseResponse> void executeReport (@Nonnull T report) {
|
private static <T extends BaseRequest<T, R>, R extends BaseResponse> void executeReport (@Nonnull T report) {
|
||||||
if (!MornyCoeur.available()) return;
|
if (unsupported()) return;
|
||||||
try {
|
try {
|
||||||
MornyCoeur.extra().exec(report);
|
MornyCoeur.extra().exec(report);
|
||||||
} catch (EventRuntimeException.ActionFailed e) {
|
} catch (EventRuntimeException.ActionFailed e) {
|
||||||
@ -34,7 +38,7 @@ public class MornyReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void exception (@Nonnull Exception e, @Nullable String description) {
|
public static void exception (@Nonnull Exception e, @Nullable String description) {
|
||||||
if (!MornyCoeur.available()) return;
|
if (unsupported()) return;
|
||||||
executeReport(new SendMessage(
|
executeReport(new SendMessage(
|
||||||
MornyCoeur.config().reportToChat,
|
MornyCoeur.config().reportToChat,
|
||||||
String.format("""
|
String.format("""
|
||||||
@ -55,7 +59,7 @@ public class MornyReport {
|
|||||||
public static void exception (@Nonnull Exception e) { exception(e, null); }
|
public static void exception (@Nonnull Exception e) { exception(e, null); }
|
||||||
|
|
||||||
public static void unauthenticatedAction (@Nonnull String action, @Nonnull User user) {
|
public static void unauthenticatedAction (@Nonnull String action, @Nonnull User user) {
|
||||||
if (!MornyCoeur.available()) return;
|
if (unsupported()) return;
|
||||||
executeReport(new SendMessage(
|
executeReport(new SendMessage(
|
||||||
MornyCoeur.config().reportToChat,
|
MornyCoeur.config().reportToChat,
|
||||||
String.format("""
|
String.format("""
|
||||||
@ -131,7 +135,7 @@ public class MornyReport {
|
|||||||
* 传入 {@link null} 则表示不表明原因。
|
* 传入 {@link null} 则表示不表明原因。
|
||||||
*/
|
*/
|
||||||
static void onMornyExit (@Nullable Object causedBy) {
|
static void onMornyExit (@Nullable Object causedBy) {
|
||||||
if (!MornyCoeur.available()) return;
|
if (unsupported()) return;
|
||||||
String causedTag = null;
|
String causedTag = null;
|
||||||
if (causedBy != null) {
|
if (causedBy != null) {
|
||||||
if (causedBy instanceof User)
|
if (causedBy instanceof User)
|
||||||
|
Loading…
Reference in New Issue
Block a user