rnotify

Crates.iornotify
lib.rsrnotify
version0.2.0
sourcesrc
created_at2022-09-03 11:58:10.532685
updated_at2023-02-22 13:11:32.274281
descriptionRnotify allows sending informative messages to various destinations such as Discord, Telegram and Mail through the command line.
homepage
repositoryhttps://github.com/tyhdefu/rnotify
max_upload_size
id657867
size158,978
(tyhdefu)

documentation

README

Rnotify - Notification manager written in rust

Rnotify sends notifications to various platforms, such as discord and telegram.

Rnotify reads a configuration file in the home directory, .config/rnotify.toml, using the toml configuration format.

Installation

Rnotify can be installed via cargo

cargo install rnotify --all-features

By default, only some destinations are included, include all by using the --all-features flag as shown above.

Updating

To update rnotify, simply re-run

cargo install rnotify --all-features

Basic Usage

Send a (info) notification to all configured destinations

rnotify -m "Message to send"

Send a notification with a title and level

rnotify -t "Title" -l warn -m "Message to send"

Send an error notification using stdin as message

echo "hi" | rnotify -t "Title" -l error

Advanced usage

For more detailed notifications we can use formatted option -f. This allows parsing of sections formatted on a line as #<Section Name># The variables in the echo are created with simple shell commands

echo "
#<Uptime>#
Uptime: $uptime
Today is: $today
#<Services>#
- Check scraper service: $checkerservicestatus
#<Disk Usage>#
\`\`\`$diskspace\`\`\`" | rnotify -t "Daily hello" -a "cron/dailyhello.sh" -f

Using the formatting option of rnotify, we can create something like this: discord notification embed

Configuration file format

Example configuration format that logs to a file and sends notifications to discord.

[[destinations]]
root = true
type = "File"
path = "/var/log/rnotify.log"

[[destinations]]
type = "Discord"
url = "https://discord.com/api/webhooks/.../..."
[[destinations.notify]]
min_level = "Warn"
notify = "<@309009265732091904>" # Notify this user, if the notification level is above a warning.
Commit count: 66

cargo fmt