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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user