aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/notificators
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-29 20:01:58 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-29 20:01:58 -0700
commit419cc923e428dcd68ca92906bf6511cbd574b8c2 (patch)
tree702fa19ae8669bf85ceedd2871feedc33d70d5cf /src/main/java/org/traccar/notificators
parentfb886b6100493019ece6a9c53bd55280525efe2e (diff)
downloadtrackermap-server-419cc923e428dcd68ca92906bf6511cbd574b8c2.tar.gz
trackermap-server-419cc923e428dcd68ca92906bf6511cbd574b8c2.tar.bz2
trackermap-server-419cc923e428dcd68ca92906bf6511cbd574b8c2.zip
Make Telegram location configurable
Diffstat (limited to 'src/main/java/org/traccar/notificators')
-rw-r--r--src/main/java/org/traccar/notificators/NotificatorTelegram.java4
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));
}
}