New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No implementation for org.telegram.telegrambots.generics.BotSession was bound #161
Comments
Please follow the steps as explained: https://github.com/rubenlagus/TelegramBots/wiki/How-To-Update#to-version-242 |
Thanks! |
same problem, How to update doesn't work in my case @SpringBootApplication
public class AutoDownloaderApplication implements CommandLineRunner {
@Autowired
private MovieGrabber movieGrabber;
@Override
public void run(String... args) throws Exception {
ApiContextInitializer.init();
TelegramBotsApi botsApi = new TelegramBotsApi();
botsApi.registerBot(movieGrabber);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(AutoDownloaderApplication.class, args);
}
} |
Try moving |
Thank you, it works :) |
@drunckoder can you please explain, why
I got the same error and your advice did help me too. Why?) |
@sslavian812 This is because it is necessary to init ApiContextInitializer before constructor of your bot. In your case you calling it in PostConstruct block, which executing after constructor executing. |
I solved this by removing the annotation @component or @service from myBots class |
@charmstead I also solved the same problem by removing the annotations; but what if you would want to autowire something like a repository in myBots class. How would you go about it? |
@charmstead I solved this problem by putting ApiContextInitializer.init() before SpringApplication.run |
@charmstead any idea, why does it work? |
@log4j2
} @SpringCloudApplication
} In this way ,I find the sloution |
In Springboot Telegram starter version 4.1, you don't need to register your bot! It is done automatically! |
I had a same problem, just add this to your main springboot class :
|
Suddenly someone will help. I had such an error when there was such a piece of code: DefaultBotOptions botOptions = ApiContext.getInstance(DefaultBotOptions.class); Maybe you, too, have lost something like this or something similar. What is the coolest thing is that I called it up to the bot constructor 😫 |
i have same problem, but i fix by add /lib directory with dependencies, my maven build:
|
As @sslavian812 mentioned, the problem is in that Bot( static {
ApiContextInitializer.init();
} into bot class to initialize context API context at static initialization stage. |
thak you. it worked |
I solved removing Autowired of TelegramBot class. `/@Autowired TelegramBotsApi botsApi = new TelegramBotsApi(); And inserting in registerBot (class) directly. |
How can I fix the following problem?
The text was updated successfully, but these errors were encountered: