feat(chat): add effect and improve faker
Some checks are pending
ci/woodpecker/push/build Pipeline is pending approval

This commit is contained in:
Simon Vieille 2025-09-07 20:22:16 +02:00
commit 4a52ec3d33
Signed by: deblan
GPG key ID: 579388D585F70417
5 changed files with 9 additions and 15 deletions

View file

@ -15,10 +15,7 @@ const createWebSocketConnection = () => {
const isInViewport = (element) => {
const rect = element.getBoundingClientRect()
return (
rect.top >= 0 &&
rect.left >= 0
)
return (rect.top - 90) > 0
}
const runChat = () => {

1
go.mod
View file

@ -14,6 +14,7 @@ require (
require (
github.com/daaku/go.zipexe v1.0.2 // indirect
github.com/go-faker/faker/v4 v4.6.1 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect

2
go.sum
View file

@ -8,6 +8,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gempir/go-twitch-irc/v4 v4.2.0 h1:OCeff+1aH4CZIOxgKOJ8dQjh+1ppC6sLWrXOcpGZyq4=
github.com/gempir/go-twitch-irc/v4 v4.2.0/go.mod h1:QsOMMAk470uxQ7EYD9GJBGAVqM/jDrXBNbuePfTauzg=
github.com/go-faker/faker/v4 v4.6.1 h1:xUyVpAjEtB04l6XFY0V/29oR332rOSPWV4lU8RwDt4k=
github.com/go-faker/faker/v4 v4.6.1/go.mod h1:arSdxNCSt7mOhdk8tEolvHeIJ7eX4OX80wXjKKvkKBY=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=

View file

@ -1,10 +1,8 @@
package store
import (
"fmt"
"math/rand"
"github.com/gempir/go-twitch-irc/v4"
"github.com/go-faker/faker/v4"
)
type TestMessage struct {
@ -12,7 +10,7 @@ type TestMessage struct {
}
func (o TestMessage) ID() string {
return fmt.Sprintf("%f", rand.Float64())
return faker.Sentence()
}
func (o TestMessage) Visible() bool {
@ -24,9 +22,9 @@ func (o TestMessage) Origin() MessageOrigin {
}
func (o TestMessage) Author() string {
return fmt.Sprintf("%f", rand.Float64())
return faker.Username()
}
func (o TestMessage) Content() string {
return fmt.Sprintf("%f", rand.Float64())
return faker.Sentence()
}

View file

@ -9,13 +9,9 @@ import (
func GenerateFakeMessages() {
go func() {
for i := 0; i < 10; i++ {
for {
store.GetMessageStore().Add(store.TestMessage{})
time.Sleep(time.Duration(rand.Intn(3000-100)+100) * time.Millisecond)
}
// for {
// store.GetMessageStore().Add(store.TestMessage{})
// time.Sleep(time.Duration(rand.Intn(3000-100)+100) * time.Millisecond)
// }
}()
}