aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/TelegramBotManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/TelegramBotManager.java')
-rw-r--r--src/main/java/com/juick/TelegramBotManager.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/com/juick/TelegramBotManager.java b/src/main/java/com/juick/TelegramBotManager.java
index 33cac896..abed77fc 100644
--- a/src/main/java/com/juick/TelegramBotManager.java
+++ b/src/main/java/com/juick/TelegramBotManager.java
@@ -23,6 +23,7 @@ import com.juick.model.CommandResult;
import com.juick.www.api.SystemActivity;
import com.juick.util.HttpUtils;
import com.juick.service.MessagesService;
+import com.juick.service.StorageService;
import com.juick.service.TelegramService;
import com.juick.service.UserService;
import com.juick.service.component.SystemEvent;
@@ -91,8 +92,8 @@ public class TelegramBotManager implements NotificationListener {
private CommandsManager commandsManager;
@Inject
private ApplicationEventPublisher applicationEventPublisher;
- @Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
- private String tmpDir;
+ @Inject
+ private StorageService storageService;
@Inject
private User serviceUser;
@@ -170,7 +171,7 @@ public class TelegramBotManager implements NotificationListener {
logger.info("got file {}", response.file());
try {
URL fileURL = new URL(bot.getFullFilePath(response.file()));
- attachment = HttpUtils.downloadImage(fileURL, tmpDir);
+ attachment = HttpUtils.downloadImage(fileURL, storageService.getTemporaryDirectory());
} catch (Exception e) {
logger.warn("attachment exception", e);
}