gobuzzer

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: MIT Imports: 6 Imported by: 1

README

Go Buzzers 📢

Can be used to send notifications (buzzers) to your mobile or desktop devices from within go.

Installation

go get -u github.com/mattiasbonte/gobuzzer

.env

Populate the .env file based on the functionality you wish you use.

TELEGRAM_AUTH_TOKEN=YOURTELEGRAMAUTHTOKEN
TELEGRAM_CHAT_ID=YOURTELEGRAMCHATID

Examples

if err := gobuzzer.TelegramNotification(telegramAuthToken, telegramChatID, notificationMessage); err != nil {
    log.Fatalf("error sending telegram message: %v", err)
}
if err := gobuzzer.SystemBuzz(notificationMessage, notificationType); err != nil {
    log.Fatalf("error sending system notification: %v", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringToMarkdownV2

func StringToMarkdownV2(text string) string

func SystemBuzz

func SystemBuzz(message string, notificationType string) error

SystemBuzz notifies the user through triggering a beep/notification/alert on the operating system. "beep" plays a subtle beep sound only. "notify" displays a notification banner without any sound. "alert" displays a notification banner with a notification sound.

func TelegramNotification

func TelegramNotification(authToken string, chatId string, message string, opts *TelegramNotificationOptions) error

TelegramNotification sends a message to a Telegram chat. https://core.telegram.org/bots/api#sendmessage

Types

type TelegramNotificationOptions

type TelegramNotificationOptions struct {
	ParseMode             string // "MarkdownV2" | "HTML" | "Markdown"
	DisableWebPagePreview bool
	DisableNotification   bool
}

Jump to

Keyboard shortcuts

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