Created
July 6, 2022 06:52
-
-
Save ievgiienko/9780a4c911314d2fa8b931f4f4a3c715 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import org.telegram.telegrambots.bots.*; | |
import org.telegram.telegrambots.meta.TelegramBotsApi; | |
import org.telegram.telegrambots.meta.api.methods.send.SendMessage; | |
import org.telegram.telegrambots.meta.api.objects.Update; | |
import org.telegram.telegrambots.meta.exceptions.TelegramApiException; | |
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession; | |
class MySuperBot extends TelegramLongPollingBot { | |
public void onUpdateReceived(Update update) { | |
var message = update.getMessage().getText(); | |
System.out.println(message); | |
} | |
public String getBotUsername() { | |
return "тут должен быть логин вашего бота"; | |
} | |
public String getBotToken() { | |
return "тут должен быть ваш токен"; | |
} | |
} | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
var bots = new TelegramBotsApi(DefaultBotSession.class); | |
bots.registerBot(new MySuperBot()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment