feat: Report command failures out loud instead of silently failing

master
Luther Wen Xu 2020-05-31 11:17:16 +07:00
parent ce43bd5864
commit 499ec2de8d
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 4 additions and 0 deletions

@ -31,6 +31,10 @@ func Event(dg *discordgo.Session, m *discordgo.MessageCreate) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
// Oh crap. We recovered from a panic. // Oh crap. We recovered from a panic.
util.SendFailEmbed(
dg, m.ChannelID, "Error",
"A fatal error has occurred while processing this command. This event has been reported.",
)
if val, ok := r.(error); ok { if val, ok := r.(error); ok {
util.ReportError(dg, val) util.ReportError(dg, val)
} else { } else {