Refactoring codes for more tg message types

This commit is contained in:
2026-03-07 22:16:14 +08:00
parent a396a381b5
commit 912f9fd0ad
26 changed files with 771 additions and 472 deletions

View File

@@ -6,7 +6,9 @@ import (
query "github.com/tgckpg/golifehk/query"
)
func Query(lang string, message string) query.IQueryResult {
func Query(q query.QueryMessage) query.IQueryResult {
lang := q.Lang
var qBusStops *query.QueryObject
var err error
@@ -18,7 +20,14 @@ func Query(lang string, message string) query.IQueryResult {
goto qrReturn
}
qBusStops, err = query.Parse(strings.ToUpper(message), busStops)
if q.Text != "" {
qBusStops, err = query.MatchKeys(strings.ToUpper(q.Text), busStops)
} else if q.Location != nil {
qBusStops, err = query.MatchNearest(*q.Location, busStops, 100, 3)
}
qBusStops.Message = &q
if err != nil {
qr.Error = err
goto qrReturn