public static void main(String[] args) {
// Set up Http proxy
DefaultBotOptions botOptions = ApiContext.getInstance(DefaultBotOptions.class);
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(PROXY_HOST, PROXY_PORT),
new UsernamePasswordCredentials(PROXY_USER, PROXY_PASSWORD));
HttpHost httpHost = new HttpHost(PROXY_HOST, PROXY_PORT);
RequestConfig requestConfig = RequestConfig.custom().setProxy(httpHost).setAuthenticationEnabled(true).build();
botOptions.setRequestConfig(requestConfig);
botOptions.setCredentialsProvider(credsProvider);
botOptions.setHttpProxy(httpHost);
ApiContextInitializer.init();
TelegramBotsApi telegramBotsApi = new TelegramBotsApi();
try {
telegramBotsApi.registerBot(new Bot(botOptions));
} catch (TelegramApiRequestException e) {
e.printStackTrace();
}
}
This is logcat:
org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error removing old webhook
at org.telegram.telegrambots.bots.TelegramLongPollingBot.clearWebhook(TelegramLongPollingBot.java:32)
at org.telegram.telegrambots.TelegramBotsApi.registerBot(TelegramBotsApi.java:120)
at Bot.main(Bot.java:61)
Getting a new token in BotFather does not help.
How to get rid of this error?
This is method main() code:
This is logcat:
Getting a new token in BotFather does not help. How to get rid of this error?