From 6d09e7b8fea478166b5c8085b81546d6d3a0ec86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=98en=20Fylling?= <7851860+andersfylling@users.noreply.github.com> Date: Fri, 21 Feb 2020 18:29:06 +0100 Subject: [PATCH] Update main.go --- docs/examples/bot-with-msg-self-delete/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/bot-with-msg-self-delete/main.go b/docs/examples/bot-with-msg-self-delete/main.go index f0a282f1..2d82300f 100644 --- a/docs/examples/bot-with-msg-self-delete/main.go +++ b/docs/examples/bot-with-msg-self-delete/main.go @@ -22,9 +22,6 @@ func main() { } func run(client *disgord.Client) { - // connect and disconnect on system interrupt - defer client.StayConnectedUntilInterrupted(context.Background()) - mdlw, err := NewMiddlewareHolder(client, context.Background()) if err != nil { panic(err) @@ -35,6 +32,9 @@ func run(client *disgord.Client) { mdlw.filterOutHumans, mdlw.filterOutOthersMsgs, autoDeleteNewMessages) + + // connect now, and disconnect on system interrupt + client.StayConnectedUntilInterrupted(context.Background()) } //////////////////////////////////////////////////////