Chat feature

This commit is contained in:
daru
2022-05-14 18:31:58 +02:00
parent 22179e38c8
commit e660b52bd4
4 changed files with 113 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"errors"
"fmt"
"time"
)
@@ -163,3 +164,10 @@ func FetchProgress(animeId, userId int64, username string, progress int) (int, t
// has no progress or dropped/hold
return 0, time.Now(), nil
}
func AddToChat(old, new, user string) string {
buf := NewRingBuf(chatLength)
buf.Write([]byte(old))
buf.Write([]byte(fmt.Sprintf("[%s][%s]: %s\n", time.Now().Format("02.01.|15:04:05"), user, new)))
return buf.String()
}