Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot represents the Telegram bot.
func New ¶
func New(token, chatID, label string, deps *Dependencies) *Bot
New creates a new Telegram bot.
func (*Bot) SendMessage ¶
SendMessage sends a Markdown message to the configured chat.
func (*Bot) SendPhoto ¶
SendPhoto sends a PNG photo with an optional caption to the configured chat.
type Dependencies ¶
type Dependencies struct {
Settings *store.SettingsStore
Secrets *store.SecretStore
Upstreams *store.UpstreamStore
Traffic *store.TrafficStore
Instances *store.InstanceStore
// Callbacks for actions that need service layer (set by caller)
GetPublicIP func(ctx context.Context) string
IsProxyRunning func(ctx context.Context) bool
GetUptime func(ctx context.Context) string
GetEngineVersion func() string
RestartProxy func(ctx context.Context) error
GenerateQR func(ctx context.Context, link string) ([]byte, error)
GetSchedulerTasks func(ctx context.Context) []string
}
Dependencies holds the stores/services the bot needs for command execution.
type TelegramMessage ¶
type TelegramMessage struct {
MessageID int64 `json:"message_id"`
Text string `json:"text"`
From struct {
ID int64 `json:"id"`
Username string `json:"username"`
} `json:"from"`
}
TelegramMessage represents a message from Telegram.
type TelegramUpdate ¶
type TelegramUpdate struct {
UpdateID int64 `json:"update_id"`
Message *TelegramMessage `json:"message,omitempty"`
}
TelegramUpdate represents an incoming update.
Click to show internal directories.
Click to hide internal directories.