decoupling start and shutdown

- start is no longer a blocking call
- giving it back to users
- the Stop method now waits for the timeout before closing
This commit is contained in:
2026-06-25 16:02:47 -04:00
parent f5948eb36e
commit e6be288302
3 changed files with 51 additions and 41 deletions
+10
View File
@@ -1,6 +1,8 @@
package bolt
import (
"time"
dg "github.com/bwmarrin/discordgo"
)
@@ -48,3 +50,11 @@ func WithLogLevel(lvl LogLevel) Option {
b.logLvl = lvl
}
}
// WithGracePeriod gives a grace period for commands to finish prior to closing the
// websocket connection with Discord
func WithGracePeriod(t time.Duration) Option {
return func(b *Bolt) {
b.grace = t
}
}