From 054f4de0e191b2623659f95db0354a667b3e99e8 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Tue, 16 Nov 2021 17:38:50 -0800 Subject: [PATCH] state: Add NewWithIdentifier --- state/state.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/state/state.go b/state/state.go index f0cce6f..7362bd5 100644 --- a/state/state.go +++ b/state/state.go @@ -123,6 +123,12 @@ func NewWithIntents(token string, intents ...gateway.Intents) *State { return NewFromSession(s, defaultstore.New()) } +// NewWithIdentifier creates a new state with the given gateway identifier. +func NewWithIdentifier(token string, id gateway.Identifier) *State { + s := session.NewWithIdentifier(id) + return NewFromSession(s, defaultstore.New()) +} + // NewWithStore creates a new state with the given store cabinet. func NewWithStore(token string, cabinet *store.Cabinet) *State { s := session.New(token)