Commit Graph

5 Commits

Author SHA1 Message Date
084b7ed979 optimize codebase
All checks were successful
Build only (for PRs) / build-only (pull_request) Successful in 4m43s
main.go:
- Eliminated ~160 lines of duplicate code: Extracted 3 new helper functions at the bottom of the file:
buildVideoMenuOptions([]VideoOption) — builds the Discord select menu options for video formats
buildAudioMenuOptions([]AudioOption) — same for audio
fetchAndShowFormats(s, i, url) — fetches formats, sorts them, builds menus, stores state, and edits the interaction; previously duplicated identically in both the download and download video command handlers
- Fixed time.Sleep ordering bug: The startAsyncDownload goroutine was launched before InteractionRespond with a 100ms sleep to compensate. Now the download is launched after InteractionRespond returns — no sleep needed. Removed "time" import.
- Used helpers in video_select handler: The two inline menu-building loops in that handler now call buildAudioMenuOptions / buildVideoMenuOptions

misc.go:
- Moved regexp.MustCompile(...) to a package-level var urlPattern — previously it recompiled the regex on every call to extractURLFromString
- Simplified the function body to a single return line
2026-03-09 11:10:33 -04:00
451333860f chore(deps): update go-ytdlp and my fork
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 7m26s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
2026-03-07 23:55:40 -05:00
a2a0aabb3a downlad into temp folder then move to out folder when done, temp replace with my fork until upstream PR is merged 2026-02-12 23:26:08 -05:00
99c6bd379a start discord-side of things 2026-01-22 23:12:19 -05:00
9345a941fb slight dl-only PoC 2026-01-21 15:40:40 -05:00