Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Errors are shown publicly #121

Open
ghost opened this issue Nov 25, 2019 · 0 comments
Open

Errors are shown publicly #121

ghost opened this issue Nov 25, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Nov 25, 2019

Parsing errors are shown publicly, which is kinda odd considering that "command not found", which undoubtably is thrown more frequent, is only logged.

I believe these lines are at fault, https://github.com/go-chat-bot/bot/blob/master/bot.go#L183-L187

Patch attached:

Index: bot.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- bot.go	(revision 3da6cae4547763aa55828a9f75ed4693bed5d36f)
+++ bot.go	(date 1574671039000)
@@ -180,11 +180,7 @@
 func (b *Bot) MessageReceived(channel *ChannelData, message *Message, sender *User) {
 	command, err := parse(message, channel, sender)
 	if err != nil {
-		b.SendMessage(OutgoingMessage{
-			Target:  channel.Channel,
-			Message: err.Error(),
-			Sender:  sender,
-		})
+		log.Fatalf("Error: %v, Channel: %v, Sender: %v", channel.Channel, err.Error(), sender.ID)
 		return
 	}
 
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants