Global code ovehaul - remove CAS and other, add 15 minute greet check

- Remove CAS, as it no longer works for us
- Remove other checks
- Implement 15 minute greet timeout check
- Fix chat logos
- Ditch thirdparty logger, use stdlib log facility wrapper for logging
This commit is contained in:
eleksir
2026-10-20 12:20:16 +03:00
parent 2f467af6cf
commit 0c34b6e781
1597 changed files with 6440 additions and 648118 deletions

View File

@@ -26,29 +26,8 @@ import (
"log"
"net/http"
"net/url"
"sync"
)
type smap struct {
m sync.Map
}
func (s *smap) load(id int64) (Bot, bool) {
bot, ok := s.m.Load(id)
if ok {
return bot.(Bot), ok
}
return nil, ok
}
func (s *smap) store(id int64, bot Bot) {
s.m.Store(id, bot)
}
func (s *smap) delete(id int64) {
s.m.Delete(id)
}
// Bot is the interface that must be implemented by your definition of
// the struct thus it represent each open session with a user on Telegram.
type Bot interface {
@@ -64,12 +43,11 @@ type NewBotFn func(chatId int64) Bot
// associated with each chatID. When a new chat ID is found, the provided function
// of type NewBotFn will be called.
type Dispatcher struct {
// sessions map[int64]Bot
sessions smap
api API
newBot NewBotFn
updates chan *Update
httpServer *http.Server
api API
sessions smap[int64, Bot]
}
// NewDispatcher returns a new instance of the Dispatcher object.