Documentation
¶
Overview ¶
Package chatpush sends an alert's words to a chat app beside Bark (gandli on X): a Telegram bot's message to one chat (Bot API sendMessage), a Discord channel's webhook, and a Pushover app's message to a user or group (VersunPan on X). Each is one POST of JSON. The bot token, the webhook address and Pushover's token and user key are secrets: an error names the server's answer, never them, as the token sits in Telegram's address and the webhook's token in its own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var PushoverAPI = "https://api.pushover.net/1/messages.json"
PushoverAPI is Pushover's message API; a var for tests, as TelegramAPI.
var TelegramAPI = "https://api.telegram.org"
TelegramAPI is the Bot API's server; a var for tests, here and in the packages that send alerts.
Functions ¶
func PushDiscord ¶
PushDiscord posts title and body to d's channel, as magpie, mentioning no one whatever the words hold.
func PushPushover ¶
PushPushover sends title and body to p's user as one plain-text message: the title as Pushover's title, the body as its message.
Types ¶
type Discord ¶
type Discord struct {
Webhook string
}
Discord is a channel's webhook address, as its Integrations page copies it.
type Pushover ¶
type Pushover struct {
Token, User string
}
Pushover is an application's API token, from the app made on pushover.net, and the user's (or a group's) key it sends to.
type Telegram ¶
type Telegram struct {
Token, Chat, API string
}
Telegram is a bot's token, from @BotFather, and the chat it writes to: a user's, group's or channel's numeric id, or a public @name. API is the Bot API server to ask, where api.telegram.org is blocked: a self-hosted telegram-bot-api or a proxy to Telegram's (Hexguu on X); "" is TelegramAPI. The token still goes in its path.