start
This commit is contained in:
parent
2c094876c8
commit
9d890ea675
8 changed files with 92 additions and 0 deletions
44
internal/bot/handler.go
Normal file
44
internal/bot/handler.go
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package bot
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.iamglitch.cc/glitch/bookmate/internal/service"
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
bot *tgbotapi.BotAPI
|
||||
service *service.Service
|
||||
}
|
||||
|
||||
func newHandler(bot *tgbotapi.BotAPI, svc *service.Service) *Handler {
|
||||
return &Handler{
|
||||
bot: bot,
|
||||
service: svc,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) HandleUpdate(ctx context.Context, update tgbotapi.Update) {
|
||||
if update.Message != nil {
|
||||
h.handleMessage(ctx, update.Message)
|
||||
}
|
||||
|
||||
if update.CallbackQuery != nil {
|
||||
h.handleCallback(ctx, update.CallbackQuery)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) handleMessage(ctx context.Context, msg *tgbotapi.Message) {
|
||||
if msg.IsCommand() {
|
||||
h.handleCommand(ctx, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) handleCommand(ctx context.Context, msg *tgbotapi.Message) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
||||
func (h *Handler) handleCallback(ctx context.Context, cb *tgbotapi.CallbackQuery) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
0
internal/bot/router.go
Normal file
0
internal/bot/router.go
Normal file
4
internal/service/service.go
Normal file
4
internal/service/service.go
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package service
|
||||
|
||||
type Service struct {
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue