7 Commits

Author SHA1 Message Date
6b9934a221 automate management of loading emote
All checks were successful
Build only (for PRs) / build-only (pull_request) Successful in 4m52s
2026-03-09 14:25:56 -04:00
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
aaf3338797 re-introduce context menu command 2026-03-07 21:05:23 -05:00
13bd3b82db minor UX tweaks 2026-03-05 21:42:56 -05:00
481c8d9bb6 replace progress percentage with actual file size 2026-03-04 23:58:11 -05:00
3cac63ba82 implement progress bar 2026-03-04 21:06:41 -05:00
4f34872f10 code cleanup 2026-02-10 21:59:30 -05:00