shithub: hell

Download patch

ref: 95adfb5f6d502e0c75f07b181c74e97033ef66e2
parent: 558fe4ec045a777265ddfa57ba42c2558613496b
author: penny <penny@limitedideas.org>
date: Wed Nov 12 16:44:07 EST 2025

show poll experation

--- a/renderer.go
+++ b/renderer.go
@@ -6,6 +6,7 @@
 	"strings"
 	"math"
 	"slices"
+	"time"
 
 	"github.com/k3a/html2text"
 
@@ -238,7 +239,10 @@
 		if poll.status.Poll.Voted {
 			show_choices = false
 		}
-		
+		if poll.status.Poll.Expired {
+			show_choices = false
+		}
+
 		for i, item := range poll.status.Poll.Options {
 			voted := " "
 			if slices.Contains(poll.status.Poll.OwnVotes, i) {
@@ -261,6 +265,9 @@
 			sb.WriteString(" multichoice.\n")
 		} else {
 			sb.WriteString("\n")
+		}
+		if !poll.status.Poll.Expired && !poll.status.Poll.ExpiresAt.IsZero() {
+			sb.WriteString(fmt.Sprintf("Poll closes in %s\n", time.Until(poll.status.Poll.ExpiresAt).Round(time.Second).String()))
 		}
 		return sb.String()
 	}
--