vibecoded fixes to fix the vibecoded slop

This commit is contained in:
david committed 2026-10-23 04:44:58 -03:00
1 parent a704744f5c
commit 00930d9d75
2 files changed
+21 -59

No files matched your search

+1 -6
View File
@@ -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