handler

package
v1.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BestUrlFile = "https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt"
	BestFile    = "trackers_best.txt"
)
View Source
const DefaultCacheDuration = 10 * time.Minute

Variables

This section is empty.

Functions

func DebugHandler added in v1.4.2

func DebugHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func MeHandler

func MeHandler(ctx context.Context, b *bot.Bot, update *models.Update)

Types

type BotContext added in v1.4.1

type BotContext struct {
	Bot       *bot.Bot
	Store     *Store
	Logger    *utils.Logger
	Config    *config.ServiceConfig
	Gotenberg *GotenbergClient
	// contains filtered or unexported fields
}

func NewBotContext added in v1.4.1

func NewBotContext() (*BotContext, error)

func (*BotContext) Start added in v1.4.1

func (ctx *BotContext) Start()

func (*BotContext) Stop added in v1.4.1

func (ctx *BotContext) Stop()

type CommandsHandler

type CommandsHandler struct {
	// contains filtered or unexported fields
}

func NewCommandsHandler

func NewCommandsHandler(ctx *BotContext) *CommandsHandler

func (*CommandsHandler) AddAlarmKeywordHandler added in v1.2.0

func (c *CommandsHandler) AddAlarmKeywordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) AddKeywordHandler

func (c *CommandsHandler) AddKeywordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) AlarmRecordHandler added in v1.4.2

func (c *CommandsHandler) AlarmRecordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) ConvertURLToIMGHandler added in v1.4.1

func (c *CommandsHandler) ConvertURLToIMGHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) ConvertURLToPDFHandler added in v1.3.0

func (c *CommandsHandler) ConvertURLToPDFHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) DeleteKeywordHandler

func (c *CommandsHandler) DeleteKeywordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) EditKeywordHandler added in v1.4.0

func (c *CommandsHandler) EditKeywordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) HandleCallbackQuery added in v1.3.0

func (c *CommandsHandler) HandleCallbackQuery(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) ListTodayHandler added in v1.4.7

func (c *CommandsHandler) ListTodayHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) SearchAlarmRecordHandler added in v1.4.2

func (c *CommandsHandler) SearchAlarmRecordHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) SearchHistoryHandler added in v1.3.0

func (c *CommandsHandler) SearchHistoryHandler(ctx context.Context, b *bot.Bot, update *models.Update)

func (*CommandsHandler) StaticHandler added in v1.4.0

func (c *CommandsHandler) StaticHandler(ctx context.Context, b *bot.Bot, update *models.Update)

type Crawler added in v1.4.1

type Crawler struct {
	// contains filtered or unexported fields
}

func NewCrawler added in v1.4.1

func NewCrawler(ctx *BotContext) *Crawler

func (*Crawler) Alarms added in v1.4.1

func (c *Crawler) Alarms(keywords []string, userId int64) []*model.Alarm

func (*Crawler) Projects added in v1.4.1

func (c *Crawler) Projects() []*Project

type GotenbergClient added in v1.4.1

type GotenbergClient struct {
	// contains filtered or unexported fields
}

func NewGotenbergClient added in v1.4.1

func NewGotenbergClient(host string, hookURL string) (*GotenbergClient, error)

func (*GotenbergClient) HtmlToImage added in v1.4.1

func (g *GotenbergClient) HtmlToImage(content string) (string, error)

func (*GotenbergClient) URLToImage added in v1.4.1

func (g *GotenbergClient) URLToImage(u string) (string, error)

func (*GotenbergClient) URLToPDF added in v1.4.1

func (g *GotenbergClient) URLToPDF(u string) (string, error)

type InfoProcessor added in v1.4.1

type InfoProcessor struct {
	// contains filtered or unexported fields
}

func NewInfoProcessor added in v1.4.1

func NewInfoProcessor(ctx *BotContext) (*InfoProcessor, error)

func (*InfoProcessor) Get added in v1.4.1

func (r *InfoProcessor) Get(userId int64)

func (*InfoProcessor) Handler added in v1.4.2

func (r *InfoProcessor) Handler(i interface{})

func (*InfoProcessor) Process added in v1.4.1

func (r *InfoProcessor) Process()

func (*InfoProcessor) Release added in v1.4.1

func (r *InfoProcessor) Release()

func (*InfoProcessor) ToMessage added in v1.4.2

func (r *InfoProcessor) ToMessage(project *Project) ([]string, int)

type MagnetHandler

type MagnetHandler struct {
	// contains filtered or unexported fields
}

func NewMagnetHandler

func NewMagnetHandler(ctx *BotContext) *MagnetHandler

func (*MagnetHandler) Handler

func (m *MagnetHandler) Handler(ctx context.Context, b *bot.Bot, update *models.Update)

type ManagerHandler

type ManagerHandler struct {
	// contains filtered or unexported fields
}

func NewManagerHandler

func NewManagerHandler(ctx *BotContext) *ManagerHandler

func (*ManagerHandler) Clean added in v1.1.0

func (h *ManagerHandler) Clean(ctx context.Context, b *bot.Bot, update *models.Update)

func (*ManagerHandler) Retry

func (h *ManagerHandler) Retry(ctx context.Context, b *bot.Bot, update *models.Update)

type ProcessData added in v1.4.1

type ProcessData struct {
	UserId       int64
	ProjectRules []*rule.ComplexRule
	AlarmKeyword []string
	Projects     []*Project
	Alarms       []*model.Alarm
	IsForced     bool
}

ProcessData holds the data for processing

type Project added in v1.4.1

type Project struct {
	NoticeTime     string `json:"noticeTime,omitempty"`
	OpenTenderCode string `json:"openTenderCode,omitempty"`
	Title          string `json:"title,omitempty"`
	ShortTitle     string `json:"-"`
	Content        string `json:"content,omitempty"`
	Pageurl        string `json:"pageurl,omitempty"`
	Keyword        string `json:"keyword,omitempty"`
	HasTenderCode  bool   `json:"-"`
}

func (*Project) SplitMessage added in v1.4.2

func (p *Project) SplitMessage() ([]string, int)

func (*Project) ToMessage added in v1.4.2

func (p *Project) ToMessage() string

type Projects added in v1.4.1

type Projects struct {
	Projects []*Project
	// contains filtered or unexported fields
}

func NewProjects added in v1.4.1

func NewProjects(ctx *BotContext, projects []*Project, rules []*rule.ComplexRule) *Projects

func (*Projects) Filter added in v1.4.2

func (r *Projects) Filter() []*Project

type Store added in v1.4.1

type Store struct {
	// contains filtered or unexported fields
}

func NewStore added in v1.4.1

func NewStore() *Store

func (*Store) Delete added in v1.4.1

func (s *Store) Delete(key string)

func (*Store) Get added in v1.4.1

func (s *Store) Get(key string) (interface{}, bool)

func (*Store) Set added in v1.4.1

func (s *Store) Set(key string, value interface{}, duration time.Duration)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL