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
|
2023-07-12 02:02:33 +03:00
|
|
|
KeyboardId KeyboardId
|
2023-07-09 01:28:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// The type represents map of sessions using
|
|
|
|
// as key.
|
|
|
|
type SessionMap map[SessionId] *Session
|
|
|
|
|
2023-07-12 00:33:51 +03:00
|
|
|
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
|
|
|
|