commit a5f5d32db9f11bb23626fa362fd92984943802a6
parent 61f0fd308c10d0494b679542d77ff09695da9c64
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Mon, 27 May 2024 18:18:04 +0200
fix: process all `#` when secondary
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/main.go b/main.go
@@ -318,12 +318,13 @@ func main() {
}
if viper.GetBool("irc.secondary") {
- _, suffix, found := strings.Cut(e.Last(), "#")
- if found && len(suffix) >= 8 {
- log.Printf("Received hash %s from %s", suffix[:8], e.Source.Name)
- news := News{ Hash: suffix[:8] }
- if !newsExists(news) {
- saveNews(news)
+ for _, suffix, found := strings.Cut(e.Last(), "#"); found && len(suffix) >= 8; _, suffix, found = strings.Cut(suffix, "#") {
+ if strings.Trim(suffix[:8], "0123456789abcdef") == "" {
+ log.Printf("Received hash %s from %s", suffix[:8], e.Source.Name)
+ news := News{Hash: suffix[:8]}
+ if !newsExists(news) {
+ saveNews(news)
+ }
}
}
}