Fix randomquote bot command

This commit is contained in:
Eduard Urbach 2018-07-02 16:22:37 +09:00
parent b857b21a2a
commit 8d3b0036d0

View File

@ -66,7 +66,10 @@ func OnMessageCreate(s *discordgo.Session, msg *discordgo.MessageCreate) {
// Random quote
if msg.Content == "!randomquote" {
allQuotes := arn.AllQuotes()
allQuotes := arn.FilterQuotes(func(quote *arn.Quote) bool {
return !quote.IsDraft && quote.IsValid()
})
quote := allQuotes[rand.Intn(len(allQuotes))]
s.ChannelMessageSend(msg.ChannelID, "https://notify.moe"+quote.Link())
return