Answer the question
In order to leave comments, you need to log in
How to include the library manually?
I want to connect the telegrambots library to a java project.
I used to do this with maven , but I want to try connecting without it, manually.
What I did:
1. In Preferences >> User Libraries I created a new "Telegram" library and added the downloaded jar of the latest version to it.
2. Added Add Library >> User Library >> Telegram to the Build Path >> Configure Build Path of the project.
Further, when I try to write initialization, I catch errors saying that the required classes were not found. In a maven project this worked.
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
public class Bot extends TelegramLongPollingBot {
public static void main(String[] args) {
try {
new TelegramBotsApi(DefaultBotSession.class).registerBot(new Bot());
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question