Documentation ¶
Overview ¶
telegram handles the reception/reply of messages. You can create a new bot by providing a valid token to NewTelegramNotifier or you can load one from a save file. The method Stop allow for a graceful shutdown although it not wait for the bot to shut down before returning : some processing may still be ongoing.
Index ¶
- type TelegramNotifier
- func LoadTelegramNotifier(path string) (*TelegramNotifier, error)
- func LoadTelegramNotifierWithBot(path string, rbot *reddit.Bot) (*TelegramNotifier, error)
- func NewTelegramNotifier(Token string) (*TelegramNotifier, error)
- func NewTelegramNotifierWithBot(Token string, rbot *reddit.Bot) (*TelegramNotifier, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TelegramNotifier ¶
TelegramNotifier
func LoadTelegramNotifier ¶
func LoadTelegramNotifier(path string) (*TelegramNotifier, error)
LoadTelegramNotifier creates a bot from the configuration file using the default bot to communicate with reddit API.
func LoadTelegramNotifierWithBot ¶
func LoadTelegramNotifierWithBot(path string, rbot *reddit.Bot) (*TelegramNotifier, error)
LoadTelegramNotifierWithBot creates a bot from the configuration file using the given bot to communicate with reddit AOU
func NewTelegramNotifier ¶
func NewTelegramNotifier(Token string) (*TelegramNotifier, error)
NewTelegramNotifier returns a valid TelegramNotifier with the given token
func NewTelegramNotifierWithBot ¶
func NewTelegramNotifierWithBot(Token string, rbot *reddit.Bot) (*TelegramNotifier, error)
NewTelegramNotifierWithBot returns a valid TelegramNotifier with the given token and using the given bot to call the reddit API.
func (*TelegramNotifier) BlockUntilKilled ¶
func (b *TelegramNotifier) BlockUntilKilled()
BlockUntilKilled wait until the TelegramNotifier receives a Stop() call, either via the function or via a Telegram message.
func (*TelegramNotifier) IsKilled ¶
func (b *TelegramNotifier) IsKilled() bool
IsKilled returns true if the TelegramNotifier won't start any new processing
func (*TelegramNotifier) Launch ¶
func (b *TelegramNotifier) Launch() error
Launch starts the bot and blocks until Stop() is called or the bot receives a message requesting halt.
func (*TelegramNotifier) SaveTo ¶
func (tn *TelegramNotifier) SaveTo(path string) error
SaveTo prints the configuration of the TelegramNotifier to a file
func (*TelegramNotifier) Stop ¶
func (b *TelegramNotifier) Stop()
Stop makes the bot stop listening to Telegram API. Ongoing requests will continue processing.
func (*TelegramNotifier) String ¶
func (tn *TelegramNotifier) String() string
String represent the current state of the TelegramNotifier