All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.khasanof.FluentStarter Maven / Gradle / Ivy

There is a newer version: 1.2.2
Show newest version
package org.khasanof;

import org.khasanof.config.ApplicationProperties;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter;
import org.springframework.boot.context.TypeExcludeFilter;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;

/**
 * Author: Nurislom
 * 
* Date: 18.06.2023 *
* Time: 11:21 *
* Package: org.khasanof.main */ @EnableConfigurationProperties(value = {ApplicationProperties.class}) @ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class), @ComponentScan.Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) }, basePackages = {"org.khasanof"}) public class FluentStarter { @Bean CommandLineRunner getRunner(MainHandler handler, ApplicationProperties properties, FluentBotSingletonBean singletonBean) { return (args -> { var registry = new TelegramBotsApi(DefaultBotSession.class); FluentBot fluentBot = new FluentBot(handler, properties); singletonBean.setInstance(fluentBot); registry.registerBot(fluentBot); }); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy