diff options
Diffstat (limited to 'src/main/java/org/traccar/notificators')
-rw-r--r-- | src/main/java/org/traccar/notificators/NotificatorTelegram.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/notificators/NotificatorTelegram.java b/src/main/java/org/traccar/notificators/NotificatorTelegram.java index 00baa2540..dbba0d31d 100644 --- a/src/main/java/org/traccar/notificators/NotificatorTelegram.java +++ b/src/main/java/org/traccar/notificators/NotificatorTelegram.java @@ -36,6 +36,7 @@ public class NotificatorTelegram extends Notificator { private final String urlSendText; private final String urlSendLocation; private final String chatId; + private final boolean sendLocation; public static class TextMessage { @JsonProperty("chat_id") @@ -67,6 +68,7 @@ public class NotificatorTelegram extends Notificator { "https://api.telegram.org/bot%s/sendLocation", Context.getConfig().getString(Keys.NOTIFICATOR_TELEGRAM_KEY)); chatId = Context.getConfig().getString(Keys.NOTIFICATOR_TELEGRAM_CHAT_ID); + sendLocation = Context.getConfig().getBoolean(Keys.NOTIFICATOR_TELEGRAM_SEND_LOCATION); } private void executeRequest(String url, Object message) { @@ -103,7 +105,7 @@ public class NotificatorTelegram extends Notificator { } message.text = NotificationFormatter.formatShortMessage(userId, event, position); executeRequest(urlSendText, message); - if (position != null) { + if (sendLocation && position != null) { executeRequest(urlSendLocation, createLocationMessage(message.chatId, position)); } } |