Documentation
¶
Index ¶
- Constants
- func ApiLink(ctx context.Context, svcCtx *svc.ServiceContext, method string) string
- func GetTelegramConfig(ctx context.Context, svcCtx *svc.ServiceContext) (*dto.TelegramConfig, error)
- func SendAdminMessage(ctx context.Context, svcCtx *svc.ServiceContext, text string, parseMode string)
- func SendUserMessage(ctx context.Context, svcCtx *svc.ServiceContext, u user.User, text string, ...)
- type TelegramAdmin
- type TelegramAdminActionStore
- type TelegramAdminDependencies
- type TelegramAdminHandler
- type TelegramLogic
- type TelegramLogicDependencies
- type TelegramMessenger
- type TelegramRedisStore
- type TelegramSessionStore
Constants ¶
const AdminOrderDaily = `` /* 474-byte string literal not displayed */
AdminOrderDaily 管理员每日订单统计
const AdminOrderNotify = `` /* 353-byte string literal not displayed */
AdminOrderNotify 管理员订单通知
const BindNotify = `` /* 247-byte string literal not displayed */
const PurchaseNotify = `` /* 388-byte string literal not displayed */
const RechargeNotify = `` /* 368-byte string literal not displayed */
RechargeNotify 充值通知
const RenewalNotify = `` /* 388-byte string literal not displayed */
const ResetTrafficNotify = `` /* 341-byte string literal not displayed */
ResetTrafficNotify 重置流量通知
const SubscribeExpireNotify = `` /* 292-byte string literal not displayed */
SubscribeExpireNotify 订阅到期通知
const UnbindNotify = `` /* 353-byte string literal not displayed */
UnbindNotify 解绑通知
Variables ¶
This section is empty.
Functions ¶
func GetTelegramConfig ¶
func GetTelegramConfig(ctx context.Context, svcCtx *svc.ServiceContext) (*dto.TelegramConfig, error)
func SendAdminMessage ¶
func SendUserMessage ¶
Types ¶
type TelegramAdmin ¶ added in v1.14.18
TelegramAdmin handles administrative Telegram commands independently from the general Telegram bot flow.
func NewTelegramAdmin ¶ added in v1.14.18
func NewTelegramAdmin(ctx context.Context, deps TelegramAdminDependencies) *TelegramAdmin
func (*TelegramAdmin) Handle ¶ added in v1.14.18
func (a *TelegramAdmin) Handle(msg *tgbotapi.Message)
Handle runs an administrator command.
type TelegramAdminActionStore ¶ added in v1.14.18
type TelegramAdminActionStore interface {
Get(ctx context.Context, key string) (string, error)
Set(ctx context.Context, key, value string, ttl time.Duration) error
Delete(ctx context.Context, key string) error
}
TelegramAdminActionStore persists short-lived confirmations for destructive administrator commands.
type TelegramAdminDependencies ¶ added in v1.14.18
type TelegramAdminDependencies struct {
Messenger TelegramMessenger
Actions TelegramAdminActionStore
Tickets repository.TicketRepo
Orders repository.OrderRepo
Users repository.UserRepo
UserAuth repository.UserAuthRepo
Subscriptions repository.UserSubscriptionRepo
UserCache repository.UserCacheRepo
Plans repository.SubscribeRepo
Logs repository.LogRepo
}
TelegramAdminDependencies contains only the collaborators used by Telegram administrator commands. It intentionally does not accept ServiceContext.
type TelegramAdminHandler ¶ added in v1.14.19
TelegramAdminHandler handles administrator Telegram commands.
type TelegramLogic ¶
func NewTelegramLogic ¶
func NewTelegramLogic(ctx context.Context, deps TelegramLogicDependencies) *TelegramLogic
func (*TelegramLogic) TelegramLogic ¶
func (l *TelegramLogic) TelegramLogic(req *tgbotapi.Update)
type TelegramLogicDependencies ¶ added in v1.14.19
type TelegramLogicDependencies struct {
Messenger TelegramMessenger
Sessions TelegramSessionStore
UserAuth repository.UserAuthRepo
UserCache repository.UserCacheRepo
Admin TelegramAdminHandler
}
TelegramLogicDependencies explicitly declares the collaborators used by general Telegram command dispatch and account binding.
type TelegramMessenger ¶ added in v1.14.18
TelegramMessenger sends a response to a Telegram chat.
func NewTelegramBotMessenger ¶ added in v1.14.19
func NewTelegramBotMessenger(bot *tgbotapi.BotAPI) TelegramMessenger
NewTelegramBotMessenger adapts a Telegram Bot API client to the command messenger port.
type TelegramRedisStore ¶ added in v1.14.19
type TelegramRedisStore interface {
TelegramSessionStore
TelegramAdminActionStore
}
TelegramRedisStore supports both account-binding sessions and administrator command confirmations.
func NewTelegramRedisStore ¶ added in v1.14.19
func NewTelegramRedisStore(client *redis.Client) TelegramRedisStore
NewTelegramRedisStore adapts Redis to the binding-session and administrator confirmation ports.