取消置顶消息可编辑检测
This commit is contained in:
parent
6fa5ab6824
commit
780834a922
1 changed files with 3 additions and 7 deletions
|
@ -44,7 +44,6 @@ public class TGBridge {
|
||||||
|
|
||||||
private TelegramBot bot;
|
private TelegramBot bot;
|
||||||
private String TOKEN = "";
|
private String TOKEN = "";
|
||||||
private long BOT_ID = -1;
|
|
||||||
private long CHAT_ID = 0L;
|
private long CHAT_ID = 0L;
|
||||||
|
|
||||||
private int ONLINE_STATUS_MESSAGE_ID = -1;
|
private int ONLINE_STATUS_MESSAGE_ID = -1;
|
||||||
|
@ -85,7 +84,6 @@ public class TGBridge {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
this.CHAT_ID = Long.parseLong(config.getOrDefault("chat_id", "0"));
|
this.CHAT_ID = Long.parseLong(config.getOrDefault("chat_id", "0"));
|
||||||
this.TOKEN = config.getOrDefault("token", "");
|
this.TOKEN = config.getOrDefault("token", "");
|
||||||
this.BOT_ID = Long.parseLong(TOKEN.split(":")[0]);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.logger.error("parsing config", e);
|
plugin.logger.error("parsing config", e);
|
||||||
|
@ -129,7 +127,7 @@ public class TGBridge {
|
||||||
updateOnlineStatus();
|
updateOnlineStatus();
|
||||||
break;
|
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).");
|
outbound("must reply a message that from the bot (or reply nothing).");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -195,10 +193,8 @@ public class TGBridge {
|
||||||
try {
|
try {
|
||||||
GetChatResponse response = bot.execute(new GetChat(CHAT_ID));
|
GetChatResponse response = bot.execute(new GetChat(CHAT_ID));
|
||||||
Message pinnedMessage = response.chat().pinnedMessage();
|
Message pinnedMessage = response.chat().pinnedMessage();
|
||||||
if (pinnedMessage.from().id() == BOT_ID) {
|
|
||||||
readOldPinnedMessage(pinnedMessage);
|
readOldPinnedMessage(pinnedMessage);
|
||||||
updateOnlineStatus();
|
updateOnlineStatus();
|
||||||
}
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
plugin.logger.error("get group info failed.");
|
plugin.logger.error("get group info failed.");
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in a new issue