You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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";
}
}
The text was updated successfully, but these errors were encountered:
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!
The text was updated successfully, but these errors were encountered: