mirror of
https://git.squeakyrat.moe/faggot-chan/
synced 2026-11-04 18:35:45 +01:00
vibecoded fixes to fix the vibecoded slop
This commit is contained in:
1 parent
a704744f5c
commit
00930d9d75
2 files changed
+21
-59
No files matched your search
+1
-6
@@ -134,7 +134,7 @@ def split_name(text: str) -> tuple[str, str]:
|
||||
|
||||
|
||||
def rename_media(old: str, name: str) -> str:
|
||||
# keeps the extension, adds _2 _3 if the name is taken. media.txt gets the new name too or the bot forgets the file on restart
|
||||
# keeps the extension, adds _2 _3 if the name is taken
|
||||
suffix = Path(old).suffix
|
||||
new = f"{name}{suffix}"
|
||||
n = 2
|
||||
@@ -144,11 +144,6 @@ def rename_media(old: str, name: str) -> str:
|
||||
if new == old:
|
||||
return old
|
||||
(MEDIA_DIR / old).rename(MEDIA_DIR / new)
|
||||
log = MEDIA_DIR / "media.txt"
|
||||
if log.exists():
|
||||
lines = log.read_text(encoding="utf-8").splitlines()
|
||||
lines = [l[:-len(old)] + new if l.endswith(f"saved media: {old}") else l for l in lines]
|
||||
log.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
||||
return new
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user