From a2b5b10625126b7e98643af9fe40569c9e004047 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sat, 18 Apr 2026 00:24:50 +0200 Subject: refactor + preparing bot for public use Signed-off-by: salmonik --- cogs/utils/temp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cogs/utils/temp.py (limited to 'cogs/utils/temp.py') diff --git a/cogs/utils/temp.py b/cogs/utils/temp.py new file mode 100644 index 0000000..528d6a3 --- /dev/null +++ b/cogs/utils/temp.py @@ -0,0 +1,18 @@ +# This file is part of Senator Sperma +# Licensed under the GPL-3.0 License +# Copyright (C) 2026 Salmonik @ salmonik@tuta.io +# https://codeberg.org/salmonik/senator-sperma + +import os +import tempfile + +def get_temp_dir(subdir: str = "senator_sperma") -> str: + """Get or create a temp subdirectory. + + Uses system temp directory (/tmp on Linux, %TEMP% on Windows). + OS handles cleanup automatically. + """ + base_temp = tempfile.gettempdir() + temp_path = os.path.join(base_temp, subdir) + os.makedirs(temp_path, exist_ok=True) + return temp_path \ No newline at end of file -- cgit v1.2.3