1
0
Fork 0
forked from mc/VTools

取消置顶消息可编辑检测

This commit is contained in:
Sodium-Aluminate 2023-11-12 18:35:58 +08:00
parent 6fa5ab6824
commit 780834a922

View file

@ -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;