knowyt/server/src/game/saveQuote.go

21 lines
343 B
Go
Raw Normal View History

2021-10-15 21:07:41 +00:00
package game
import (
"fmt"
)
2021-10-16 14:57:28 +00:00
func (gm *Game) SaveQuote(fileName, usrId, quoteId, quoteText string) error {
2021-10-15 21:07:41 +00:00
quote, err := gm.getQuoteById(quoteId)
if err != nil {
return err
}
if quote.GetSourceId() != usrId {
return fmt.Errorf("usrId does not match quote source id")
}
2021-10-16 14:57:28 +00:00
quote.SetQuote(quoteText)
2021-10-15 21:07:41 +00:00
2021-10-16 14:57:28 +00:00
return quote.Save(fileName)
2021-10-15 21:07:41 +00:00
}