Struct pling::Telegram [−][src]
pub struct Telegram {
pub bot_token: String,
pub target_chat: TargetChat,
pub disable_web_page_preview: bool,
pub disable_notification: bool,
}
Expand description
Send a Telegram message
Documentation
Needs to be compiled with feature http-sync
or http-async
Usage TLDR
- Create
BOT_TOKEN
via @BotFather in Telegram - Add the created bot to the chat/channel or write the bot a first message
- Somehow obtain the Chat/User ID or Chat/Channel Username (TODO) that should receive the notification
Environment Variables
TELEGRAM_BOT_TOKEN
(required)TELEGRAM_TARGET_CHAT
(required)TELEGRAM_DISABLE_WEB_PAGE_PREVIEW
(optional)TELEGRAM_DISABLE_NOTIFICATION
(optional)
Fields
bot_token: String
target_chat: TargetChat
disable_web_page_preview: bool
disable_notification: bool
Implementations
Loads the Telegram config from environment variables. The following variables are used:
TELEGRAM_BOT_TOKEN
TELEGRAM_TARGET_CHAT
TELEGRAM_DISABLE_WEB_PAGE_PREVIEW
TELEGRAM_DISABLE_NOTIFICATION
When TELEGRAM_BOT_TOKEN
or TELEGRAM_TARGET_CHAT
are unset None is returned.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Telegram
impl UnwindSafe for Telegram
Blanket Implementations
Mutably borrows from an owned value. Read more