chatpush

package
v0.1.5029 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) and a Discord channel's webhook. Each is one POST of JSON. The bot token and the webhook address 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

View Source
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

func PushDiscord(ctx context.Context, d Discord, title, body string) error

PushDiscord posts title and body to d's channel, as magpie, mentioning no one whatever the words hold.

func PushTelegram

func PushTelegram(ctx context.Context, t Telegram, title, body string) error

PushTelegram sends title and body to t's chat as one plain-text message.

Types

type Discord

type Discord struct {
	Webhook string
}

Discord is a channel's webhook address, as its Integrations page copies it.

func (Discord) On

func (d Discord) On() bool

On is whether there is a webhook to send to.

type Telegram

type Telegram struct {
	Token, Chat 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.

func (Telegram) On

func (t Telegram) On() bool

On is whether there is a token and a chat to send to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL