From 13bd3b82db97f5d07527040560be953eea4117ff Mon Sep 17 00:00:00 2001 From: William P Date: Thu, 5 Mar 2026 21:42:56 -0500 Subject: [PATCH] minor UX tweaks --- app/download.go | 14 +++++++------- app/main.go | 6 ++---- app/misc.go | 7 ++++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/download.go b/app/download.go index ea6c206..a047e03 100644 --- a/app/download.go +++ b/app/download.go @@ -20,7 +20,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re // Handle panic from DownloadVideo resultChan <- DownloadResult{ Success: false, - Message: fmt.Sprintf("Download failed: %v", r), + Message: fmt.Sprintf("❌ **Download Failed**: %v", r), URL: url, Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID), Error: fmt.Errorf("%v", r), @@ -39,7 +39,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re // If we reach here, download was successful resultChan <- DownloadResult{ Success: true, - Message: "Video Downloaded Successfully!", + Message: "✅ **Successfully Downloaded**", URL: url, Format: fmt.Sprintf("video: %s, audio: %s", videoFormatID, audioFormatID), Error: nil, @@ -49,7 +49,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re // Handle progress and results asynchronously go func() { _, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ - Content: ptr(" downloading: starting..."), + Content: ptr(fmt.Sprintf("%s **Starting Download**", loading_emoji)), }) if err != nil { log.Printf("Error updating interaction: %v", err) @@ -65,7 +65,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re var content string if prog.Phase == "post-processing" { - content = " post-processing" + content = fmt.Sprintf("%s **Post Processing**", loading_emoji) } else { var progressStr string if prog.DownloadedBytes > 0 { @@ -73,7 +73,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re } else { progressStr = "starting..." } - content = fmt.Sprintf(" Downloading Video: %s", progressStr) + content = fmt.Sprintf("%s **Downloading Video**: %s", loading_emoji, progressStr) } _, err := s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ @@ -86,7 +86,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re case result := <-resultChan: if result.Success { _, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ - Content: ptr("✅ Success"), + Content: ptr("✅ **Successfully Downloaded**"), }) _, err = s.FollowupMessageCreate(i.Interaction, false, &discordgo.WebhookParams{ Content: fmt.Sprintf("## Video Downloaded \n**URL**: %s \n**Quality**: %s + %s \n**Requested By**: <@%s> \n", result.URL, videoFormatName, audioFormatName, requester), @@ -96,7 +96,7 @@ func startAsyncDownload(s *discordgo.Session, i *discordgo.InteractionCreate, re } } else { _, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ - Content: ptr("❌ Download failed: " + result.Message), + Content: ptr("❌ **Download Failed**: " + result.Message), }) if err != nil { log.Printf("Error updating interaction: %v", err) diff --git a/app/main.go b/app/main.go index 69fe5ca..9986f4b 100644 --- a/app/main.go +++ b/app/main.go @@ -13,7 +13,6 @@ import ( ) func main() { - out_dir := os.Getenv("OUT_PATH") temp_dir := os.Getenv("TEMP_PATH") bot_token := os.Getenv("DISCORD_TOKEN") @@ -273,8 +272,7 @@ func main() { response := "" if state.URL != "" { // Respond immediately to prevent timeout - response = fmt.Sprintf("🚀 Starting download...\nURL: %s\nVideo: %s\nAudio: %s\n\nYou'll receive an update when the download completes!", - state.URL, state.VideoFormatID, state.AudioFormatID) + response = fmt.Sprintf("%s **Starting download**", loading_emoji) // Start async download after responding go func() { @@ -327,7 +325,7 @@ func main() { err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ - Content: "🔍 Fetching available formats...", + Content: fmt.Sprintf("%s Fetching available formats...", loading_emoji), Flags: discordgo.MessageFlagsEphemeral, }, }) diff --git a/app/misc.go b/app/misc.go index 57a61b6..b05f15c 100644 --- a/app/misc.go +++ b/app/misc.go @@ -1,6 +1,11 @@ package main -import "fmt" +import ( + "fmt" + "os" +) + +var loading_emoji = os.Getenv("LOADING_EMOJI") // Helper function to create string pointer func ptr(s string) *string {