tg/src/behx/session.go

30 lines
551 B
Go
Raw Normal View History

2023-07-09 01:28:59 +03:00
package behx
// Represents unique value to identify chats.
// In fact is simply ID of the chat.
type SessionId int64
// The type represents current state of
// user interaction per each of them.
type Session struct {
Id SessionId
CurrentScreenId ScreenId
PreviousScreenId ScreenId
KeyboardId KeyboardId
2023-07-09 01:28:59 +03:00
}
// The type represents map of sessions using
// as key.
type SessionMap map[SessionId] *Session
func (si SessionId) ToTelegram() int64 {
return int64(si)
}
func (sm SessionMap) Add(sid SessionId) {
sm[sid] = &Session{
Id: sid,
}
}
2023-07-09 01:28:59 +03:00