24 lines
520 B
Go
Raw Normal View History

2018-07-10 15:46:17 +00:00
package commands
import (
"math/rand"
"github.com/animenotifier/arn"
"github.com/bwmarrin/discordgo"
)
// RandomQuote shows a random quote.
func RandomQuote(s *discordgo.Session, msg *discordgo.MessageCreate) bool {
if msg.Content != "!randomquote" {
return false
}
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 true
}