Feat: word loader
This commit is contained in:
@ -4,9 +4,11 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"golias/broker"
|
||||
"golias/models"
|
||||
"golias/utils"
|
||||
"golias/wordloader"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -248,3 +250,14 @@ func notify(event, msg string) {
|
||||
Payload: msg,
|
||||
}
|
||||
}
|
||||
|
||||
func loadCards(room *models.Room) {
|
||||
wl := wordloader.InitDefaultLoader("assets/words/en_nouns.txt")
|
||||
cards, err := wl.Load()
|
||||
if err != nil {
|
||||
// no logger
|
||||
fmt.Println("failed to load cards", "error", err)
|
||||
}
|
||||
room.Cards = cards
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user