Browse Source

handler: Fixed issue caused by trying to post empty post. Root cause is not found, but offending posts will be ignored.

master 1.0.1
Gisle Aune 6 years ago
parent
commit
304c645043
  1. 6
      internal/bot/handler.go
  2. 4
      internal/util/npc_test.go

6
internal/bot/handler.go

@ -96,6 +96,12 @@ func handler(event *irc.Event, client *irc.Client) {
text = util.RemoveNPCAttribution(event.Text)
}
// Do not dispatch empty messages.
if len(text) < 1 || len(nick) < 1 || len(kind) < 1 {
log.Println("Ignoring empty message from:", event.Nick)
break
}
// Dispatch it.
bot.handlePost(channel.Name(), ChannelPost{
Account: account,

4
internal/util/npc_test.go

@ -28,6 +28,10 @@ func TestRemoveNPCAttribution(t *testing.T) {
Input: "((*Correction))",
Output: "((*Correction))",
},
{
Input: "((Remove :01 goofs!*))",
Output: "((Remove :01 goofs!*))",
},
}
for i, row := range table {

Loading…
Cancel
Save