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 implement transmission telegram bot.
type Logger ¶
type Logger interface { Infof(fmt string, args ...interface{}) Debugf(fmt string, args ...interface{}) }
Logger defines a logger interface accepted by the bot.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option customized bot with optional configuration.
func WithAllowedUsers ¶ added in v0.2.0
WithAllowedUser sets a username of the telegram account that is allowed to control the bot.
func WithHTTPClient ¶
WithHTTPClient sets an HTTP client for the bot.
func WithLocations ¶
WithLocations adds new torrent contents locations.
func WithLogger ¶
WithLogger configures the bot to use l for logging.
func WithSetCommands ¶
func WithSetCommands() Option
WithSetCommands tells the bot to upload up-to-date list of the supported commands to the Telegram servers. It's not considered to be a fatal error if the upload fails. Alternitevly, this can be done manually via @BotFather.
type Telegram ¶
type Telegram interface { MakeRequest(string, url.Values) (tgbotapi.APIResponse, error) GetUpdates(tgbotapi.UpdateConfig) ([]tgbotapi.Update, error) Send(tgbotapi.Chattable) (tgbotapi.Message, error) GetFileDirectURL(string) (string, error) AnswerCallbackQuery(tgbotapi.CallbackConfig) (tgbotapi.APIResponse, error) }
Telegram defines an interface that telegram client must implement in order to be usable by this bot.
type Transmission ¶
type Transmission interface { AddTorrent(context.Context, *transmission.AddTorrentReq) (*transmission.NewTorrent, error) IsPortOpen(context.Context) (bool, error) GetSessionStats(context.Context) (*transmission.SessionStats, error) GetSession(context.Context, ...transmission.SessionField) (*transmission.Session, error) SetSession(context.Context, *transmission.SetSessionReq) error StartTorrents(context.Context, transmission.Identifier) error StopTorrents(context.Context, transmission.Identifier) error GetTorrents(context.Context, transmission.Identifier, ...transmission.TorrentField) ([]*transmission.Torrent, error) RemoveTorrents(context.Context, transmission.Identifier, bool) error }
Transmission defines an interface that transmission client must implement in order to be usable by this bot.