rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.79k stars 1.23k forks source link

Why is it that when creating a group, "type" is always "supergroup"? Will update.getMessage().getChat().isGroupChat() always be invalid? #1449

Open LenBryan opened 1 month ago

LenBryan commented 1 month ago

I create a group in Telegram. I don't care whether it is a private group or a public group. When I send messages to the group and then listen through webhook, the "type" is always "supergroup".

@Override public BotApiMethod<?> onWebhookUpdateReceived(Update update) { if (update.hasMessage() && update.getMessage().hasText()) { String messageText = update.getMessage().getText(); Long chatId = update.getMessage().getChatId(); if (update.getMessage().getChat().isGroupChat()) { String response = "group message: " + messageText; sendMessageToGroup(chatId, response); } } return null; }

I'm using:

org.telegram telegrambots-spring-boot-starter 6.8.0