Send Telegram location per user (fix #5174)

This commit is contained in:
Anton Tananaev
2026-05-23 13:58:13 -07:00
parent 4a2ad0d0a9
commit da48f062e1
2 changed files with 5 additions and 2 deletions

View File

@@ -1409,7 +1409,7 @@ public final class Keys {
*/
public static final ConfigKey<Boolean> NOTIFICATOR_TELEGRAM_SEND_LOCATION = new BooleanConfigKey(
"notificator.telegram.sendLocation",
List.of(KeyType.CONFIG));
List.of(KeyType.CONFIG, KeyType.USER));
/**
* Telegram notification proxy URL.

View File

@@ -116,7 +116,10 @@ public class NotificatorTelegram extends Notificator {
}
message.text = shortMessage.digest();
client.target(urlSendText).request().post(Entity.json(message)).close();
if (sendLocation && position != null) {
boolean sendUserLocation = user.hasAttribute(Keys.NOTIFICATOR_TELEGRAM_SEND_LOCATION.getKey())
? user.getBoolean(Keys.NOTIFICATOR_TELEGRAM_SEND_LOCATION.getKey())
: sendLocation;
if (sendUserLocation && position != null) {
client.target(urlSendLocation).request().post(
Entity.json(createLocationMessage(message.chatId, position))).close();
}