Skip to content

Conversation

@taragrammatonn
Copy link

No description provided.

Copy link

@yvasyliev yvasyliev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the whole change is about Bot Command mapping, I would name the module and related classes more specifically (e.g. telegrambots-springboot-longpolling-command-starter)

Comment on lines +30 to +34
@Bean
@ConditionalOnMissingBean
public OkHttpClient okHttpClient() {
return new OkHttpClient();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is OkHttpClient bean created but never used?

}

@Bean
public SpringLongPollingBot springLongPollingBot(TelegramBotProperties properties,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add @ConditionalOnMissingBean for extension opportunity

Comment on lines +52 to +64
@Bean
@ConditionalOnMissingBean(TelegramBotsLongPollingApplication.class)
public TelegramBotsLongPollingApplication telegramBotsApplication() {
return new TelegramBotsLongPollingApplication();
}

@Bean
@ConditionalOnMissingBean
public TelegramBotInitializer telegramBotInitializer(TelegramBotsLongPollingApplication telegramBotsApplication,
ObjectProvider<List<SpringLongPollingBot>> longPollingBots) {
return new TelegramBotInitializer(telegramBotsApplication,
longPollingBots.getIfAvailable(Collections::emptyList));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since telegrambots-springboot-longpolling-starter is transitively included into into telegrambost-springboot-mapping-starter, no need to define TelegramBotsLongPollingApplication & TelegramBotInitializer beans explicitly

Comment on lines +26 to +29
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spring-boot-starter dependency is redundant in this module

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Missing value attribute.
  2. I believe the alias should be commands instead of command.

BotRequestMapping annotation = AnnotationUtils.findAnnotation(method, BotRequestMapping.class);
if (annotation != null) {
for (String command : annotation.value()) {
handlers.put(command, new BotHandlerMethod(bean, method));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if a method has exactly one parameter of Update?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be a record

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unused/duplicated imports

}

public void handleUpdate(Update update) {
if (update.hasMessage() && update.getMessage().hasText()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's Message.isCommand() method

<version>8.2.0</version>
</parent>

<artifactId>telegrambost-springboot-mapping-starter</artifactId>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: telegrambots

@rubenlagus rubenlagus force-pushed the dev branch 3 times, most recently from 52a184e to 9203912 Compare September 7, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants