Improved error handling for the discord bot

This commit is contained in:
2019-06-05 14:56:12 +09:00
parent dd36c852d3
commit 190a85fe08
11 changed files with 130 additions and 24 deletions

View File

@ -3,6 +3,7 @@ package commands
import (
"math/rand"
"github.com/akyoto/color"
"github.com/animenotifier/notify.moe/arn"
"github.com/bwmarrin/discordgo"
)
@ -18,6 +19,11 @@ func RandomQuote(s *discordgo.Session, msg *discordgo.MessageCreate) bool {
})
quote := allQuotes[rand.Intn(len(allQuotes))]
s.ChannelMessageSend(msg.ChannelID, "https://notify.moe"+quote.Link())
_, err := s.ChannelMessageSend(msg.ChannelID, "https://notify.moe"+quote.Link())
if err != nil {
color.Red(err.Error())
}
return true
}