Hi! I made my first Telegram bot. It's able to listen for new messages in the Telegram bot (BotFarther), code below, but I need to listen for new messages on my Telegram account! Not bot! How to do it help me please!
package org.example;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
public class Main {
public static void main(String[] args) {
try {
TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class);
MyBot bot = new MyBot();
telegramBotsApi.registerBot(bot);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
}
class MyBot extends TelegramLongPollingBot {
@Override
public void onUpdateReceived(Update update) {
System.out.println("Hello World");
}
@Override
public String getBotUsername() {
return "BOT_USERNAME";
}
@Override
public String getBotToken() {
return "BOT_TOKEN";
}
}
Hi! I made my first Telegram bot. It's able to listen for new messages in the Telegram bot (BotFarther), code below, but I need to listen for new messages on my Telegram account! Not bot! How to do it help me please!