From a602917008ef5b0cc8800a74da6439e71c205888 Mon Sep 17 00:00:00 2001 From: cws Date: Wed, 28 Jun 2017 09:18:41 -0400 Subject: [PATCH] bot: make plugins run async --- bot/handlers.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bot/handlers.go b/bot/handlers.go index 18bb052..1d8d6b4 100644 --- a/bot/handlers.go +++ b/bot/handlers.go @@ -29,12 +29,14 @@ func (b *bot) MsgReceived(msg msg.Message) { goto RET } - for _, name := range b.pluginOrdering { - p := b.plugins[name] - if p.Message(msg) { - break + go (func() { + for _, name := range b.pluginOrdering { + p := b.plugins[name] + if p.Message(msg) { + break + } } - } + })() RET: b.logIn <- msg