From 780834a922ac0e687f3da929ff0ad6ddd605b511 Mon Sep 17 00:00:00 2001 From: Sodium-Aluminate Date: Sun, 12 Nov 2023 18:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BD=AE=E9=A1=B6=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=8F=AF=E7=BC=96=E8=BE=91=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/de/strifel/VTools/listeners/TGBridge.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/strifel/VTools/listeners/TGBridge.java b/src/main/java/de/strifel/VTools/listeners/TGBridge.java index 263a9ca..98f9724 100644 --- a/src/main/java/de/strifel/VTools/listeners/TGBridge.java +++ b/src/main/java/de/strifel/VTools/listeners/TGBridge.java @@ -44,7 +44,6 @@ public class TGBridge { private TelegramBot bot; private String TOKEN = ""; - private long BOT_ID = -1; private long CHAT_ID = 0L; private int ONLINE_STATUS_MESSAGE_ID = -1; @@ -85,7 +84,6 @@ public class TGBridge { synchronized (this) { this.CHAT_ID = Long.parseLong(config.getOrDefault("chat_id", "0")); this.TOKEN = config.getOrDefault("token", ""); - this.BOT_ID = Long.parseLong(TOKEN.split(":")[0]); } } catch (Exception e) { plugin.logger.error("parsing config", e); @@ -129,7 +127,7 @@ public class TGBridge { updateOnlineStatus(); break; } - if (replyTo != null && (replyTo.from() == null || replyTo.from().id() != BOT_ID || replyTo.messageId() <= 0)) { + if (replyTo != null && (replyTo.from() == null || replyTo.messageId() <= 0)) { outbound("must reply a message that from the bot (or reply nothing)."); break; } @@ -195,10 +193,8 @@ public class TGBridge { try { GetChatResponse response = bot.execute(new GetChat(CHAT_ID)); Message pinnedMessage = response.chat().pinnedMessage(); - if (pinnedMessage.from().id() == BOT_ID) { - readOldPinnedMessage(pinnedMessage); - updateOnlineStatus(); - } + readOldPinnedMessage(pinnedMessage); + updateOnlineStatus(); } catch (RuntimeException e) { plugin.logger.error("get group info failed."); throw e;