shithub: hell

Download patch

ref: 50819e2b5e6275ec6b2633522acfe33aeadf9ce4
parent: 764442ad56237aeacbf324adb574ce1ee3344283
author: penny <penny@limitedideas.org>
date: Fri Oct 3 16:59:26 EDT 2025

allow setting image descriptionriptions on attachments

--- a/filehandler.go
+++ b/filehandler.go
@@ -10,6 +10,7 @@
 	"path"
 	"path/filepath"
 	"context"
+	"bytes"
 
 	mastodon "codeberg.org/penny64/hellclient-go-mastodon"
 	"github.com/google/shlex"
@@ -162,9 +163,17 @@
 	if err != nil {
 		return err
 	}
-	attachment, err := sam.client.UploadMediaFromBytes(context.Background(), *file)
+	config := sam.rl.GetConfig()
+	config.Prompt = "Image description: "
+	description, _ := sam.rl.ReadLineWithConfig(config)
+	reader := bytes.NewReader(*file)
+	media := &mastodon.Media{File: reader, Description: description}
+	attachment, err := sam.client.UploadMediaFromMedia(context.Background(), media)
 	sam.attachments = append(sam.attachments, attachment)
-	return err
+	if err != nil {
+		return err
+	}
+	return nil
 }
 
 func (sam *StatusAttachmentHolder) enqueuedAttachments() int {
--- a/prompt.go
+++ b/prompt.go
@@ -68,7 +68,7 @@
 type PauseIndicator struct {
 	*Hellclient
 }
-
+// Display whether the client is paused or not
 func (pi *PauseIndicator) Update() (string, bool, error) {
 	if pi.isPaused {
 		return "STREAM PAUSED", true, nil
@@ -86,7 +86,9 @@
 	sb.WriteString("ATTACHED:[")
 	for item := range sam.attachments {
 		sb.WriteString(sam.attachments[item].Type)
-		sb.WriteString(" ")
+		if item != len(sam.attachments) {
+			sb.WriteString(" ")
+		}
 	}
 	sb.WriteString("]")
 	return sb.String(), true, nil
--