metadata-2 (#2273)
Some checks failed
build / build (push) Has been cancelled
ghcr / Build (push) Has been cancelled

Initial implementation of draft/metadata-2
This commit is contained in:
thatcher-gaming 2025-06-15 09:06:45 +01:00 committed by GitHub
parent 0f5603eca2
commit 4dcbc48159
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 660 additions and 3 deletions

28
irc/utils/chunks.go Normal file
View file

@ -0,0 +1,28 @@
package utils
import "iter"
func ChunkifyParams(params iter.Seq[string], maxChars int) [][]string {
var chunked [][]string
var acc []string
var length = 0
for p := range params {
length = length + len(p) + 1 // (accounting for the space)
if length > maxChars {
chunked = append(chunked, acc)
acc = []string{}
length = 0
}
acc = append(acc, p)
}
if len(acc) != 0 {
chunked = append(chunked, acc)
}
return chunked
}