From 8d3b0036d040cdc49285148eae0b2bae5a05ddc5 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 2 Jul 2018 16:22:37 +0900 Subject: [PATCH] Fix randomquote bot command --- bots/discord/OnMessageCreate.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bots/discord/OnMessageCreate.go b/bots/discord/OnMessageCreate.go index 78fab633..a50af842 100644 --- a/bots/discord/OnMessageCreate.go +++ b/bots/discord/OnMessageCreate.go @@ -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