diff options
Diffstat (limited to 'src/main/java/files/App.java')
-rw-r--r-- | src/main/java/files/App.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/files/App.java b/src/main/java/files/App.java index 23bf859..a219d50 100644 --- a/src/main/java/files/App.java +++ b/src/main/java/files/App.java @@ -15,8 +15,11 @@ import java.util.Properties; public class App { public static void main(String[] args) throws IOException { + // Loading properties Properties properties = new Properties(); properties.load(new FileInputStream("app.properties")); + + // Creating telegram bot TelegramBot bot = new TelegramBot(properties.getProperty("telegram_token")); bot.setUpdatesListener(updates -> { @@ -31,7 +34,7 @@ public class App { String username = update.message().from().username(); String date = new java.text.SimpleDateFormat("dd.MM.yyyy HH:mm:ss").format(new java.util.Date(update.message().date() * 1000L)); if (update.message().chat().lastName() != null) fullName += " " + update.message().chat().lastName(); - System.out.println(update.message().from().firstName() + " " + update.message().chat().lastName()); + bot.execute(new SendMessage(update.message().chat().id(), "Привет!")); User user = new User(telegramId, isBot, fullName, date); |