Update Telegram.java

This commit is contained in:
iCaitlyn 2022-02-09 01:21:49 +08:00 committed by GitHub
parent 10fe3f3ad7
commit d0ee4ac4f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,7 @@ public class Telegram {
} else if (!chat.isPrivate()) { } else if (!chat.isPrivate()) {
// group chat // group chat
int id = chat.getId(); long id = chat.getId();
if (!TelegramChat.getBackend().chat_ids.contains(id)) if (!TelegramChat.getBackend().chat_ids.contains(id))
TelegramChat.getBackend().chat_ids.add(id); TelegramChat.getBackend().chat_ids.add(id);
@ -127,7 +127,7 @@ public class Telegram {
public void handleUserMessage(String text, Update update) { public void handleUserMessage(String text, Update update) {
Chat chat = update.getMessage().getChat(); Chat chat = update.getMessage().getChat();
int user_id = update.getMessage().getFrom().getId(); long user_id = update.getMessage().getFrom().getId();
if (TelegramChat.getBackend().getLinkCodes().containsKey(text)) { if (TelegramChat.getBackend().getLinkCodes().containsKey(text)) {
// LINK // LINK
TelegramChat.link(TelegramChat.getBackend().getUUIDFromLinkCode(text), user_id); TelegramChat.link(TelegramChat.getBackend().getUUIDFromLinkCode(text), user_id);
@ -148,7 +148,7 @@ public class Telegram {
} }
} }
public void sendMsg(int id, String msg) { public void sendMsg(long id, String msg) {
ChatMessageToTelegram chat = new ChatMessageToTelegram(); ChatMessageToTelegram chat = new ChatMessageToTelegram();
chat.chat_id = id; chat.chat_id = id;
chat.text = msg; chat.text = msg;
@ -168,7 +168,7 @@ public class Telegram {
public void sendAll(final ChatMessageToTelegram chat) { public void sendAll(final ChatMessageToTelegram chat) {
new Thread(new Runnable() { new Thread(new Runnable() {
public void run() { public void run() {
for (int id : TelegramChat.getBackend().chat_ids) { for (long id : TelegramChat.getBackend().chat_ids) {
chat.chat_id = id; chat.chat_id = id;
// post("sendMessage", gson.toJson(chat, Chat.class)); // post("sendMessage", gson.toJson(chat, Chat.class));
sendMsg(chat); sendMsg(chat);