fact: remove ownership check for delete

This commit is contained in:
cws 2017-06-07 14:46:34 -04:00
parent 2ebc5fe18f
commit 59b92bdf3c
1 changed files with 8 additions and 11 deletions

View File

@ -439,18 +439,15 @@ func (p *Factoid) forgetLastFact(message msg.Message) bool {
p.Bot.SendMessage(message.Channel, "I refuse.") p.Bot.SendMessage(message.Channel, "I refuse.")
return true return true
} }
if message.User.Admin || message.User.Name == p.LastFact.Owner {
err := p.LastFact.delete(p.db) err := p.LastFact.delete(p.db)
if err != nil { if err != nil {
log.Println("Error removing fact: ", p.LastFact, err) log.Println("Error removing fact: ", p.LastFact, err)
}
fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id.Int64, p.LastFact.Fact,
p.LastFact.Verb, p.LastFact.Tidbit)
p.Bot.SendAction(message.Channel, "hits himself over the head with a skillet")
p.LastFact = nil
} else {
p.Bot.SendMessage(message.Channel, "You don't own that fact.")
} }
fmt.Printf("Forgot #%d: %s %s %s\n", p.LastFact.id.Int64, p.LastFact.Fact,
p.LastFact.Verb, p.LastFact.Tidbit)
p.Bot.SendAction(message.Channel, "hits himself over the head with a skillet")
p.LastFact = nil
return true return true
} }