2021-10-15 21:07:41 +00:00
|
|
|
package game
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2021-10-16 17:36:39 +00:00
|
|
|
"os"
|
2021-10-15 21:07:41 +00:00
|
|
|
)
|
|
|
|
|
2021-10-16 17:36:39 +00:00
|
|
|
func (gm *Game) RemoveQuote(fileName, usrId, quoteId string) error {
|
|
|
|
if quote, err := gm.getQuoteById(quoteId); err != nil {
|
|
|
|
return err
|
|
|
|
} else {
|
|
|
|
if quote.GetSourceId() != usrId {
|
|
|
|
return fmt.Errorf("usrId does not match quote source id")
|
|
|
|
}
|
2021-10-15 21:07:41 +00:00
|
|
|
}
|
|
|
|
|
2021-10-16 17:36:39 +00:00
|
|
|
err := os.Remove(fileName)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2021-10-15 21:07:41 +00:00
|
|
|
}
|
|
|
|
|
2021-10-16 17:36:39 +00:00
|
|
|
return nil
|
2021-10-15 21:07:41 +00:00
|
|
|
}
|