mirror of
https://github.com/diamondburned/cchat-discord.git
synced 2024-11-01 12:24:15 +00:00
20 lines
384 B
Go
20 lines
384 B
Go
|
package session
|
||
|
|
||
|
import (
|
||
|
"github.com/diamondburned/cchat"
|
||
|
"github.com/diamondburned/cchat-discord/internal/discord/state"
|
||
|
)
|
||
|
|
||
|
var Restorer cchat.SessionRestorer = restorer{}
|
||
|
|
||
|
type restorer struct{}
|
||
|
|
||
|
func (restorer) RestoreSession(data map[string]string) (cchat.Session, error) {
|
||
|
i, err := state.NewFromData(data)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return NewFromInstance(i)
|
||
|
}
|