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:
parent
9dcd88b8c1
commit
0ea98f30d0
1 changed files with 34 additions and 0 deletions
34
Ok
Normal file
34
Ok
Normal 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";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue