1
0
Fork 0
mirror of https://github.com/DrKLO/Telegram.git synced 2025-01-13 21:23:57 +01:00

Create Ok

Don't know
This commit is contained in:
Omo1204 2024-12-09 14:25:54 +06:00 committed by GitHub
parent 9dcd88b8c1
commit 0ea98f30d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

34
Ok Normal file
View file

@ -0,0 +1,34 @@
public class LoggingTestBot extends TelegramLongPollingBot {
@Override
public void onUpdateReceived(Update update) {
// We check if the update has a message and the message has text
if (update.hasMessage() && update.getMessage().hasText()) {
// Set variables
String message_text = update.getMessage().getText();
long chat_id = update.getMessage().getChatId();
SendMessage message = new SendMessage() // Create a message object object
.setChatId(chat_id)
.setText(message_text);
try {
execute(message); // Sending our message object to user
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
}
@Override
public String getBotUsername() {
// Return bot username
// If bot username is @MyAmazingBot, it must return 'MyAmazingBot'
return "LoggingTestBot";
}
@Override
public String getBotToken() {
// Return bot token from BotFather
return "12345:qwertyuiopASDGFHKMK";
}
}