telewatch

package module
v0.0.0-...-467e1ef Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 10 Imported by: 0

README

telewatch

Watch with telegram 🔭

Install

$ git clone https://github.com/luavis/telewatch
$ cd telewatch
$ go build -o telewatch cmd/main.go
$ mkdir -p ~/.config/telewatch
$ echo "token: xxxxxx:XXXXXXXXXXX" > ~/.config/telewatch/token.yml

Telegram bot need to know chat id with you, so run telewatch register then send any message to your bot.

$ telewatch register
Send any message to your bot, telewatch will save your chat id
Your telegram bot link: https://t.me/YOUR_BOT_NAME
Receive: hello world
Chat id: xxxxxx
Chat id is successfully saved

Examples

  • send message when changed
    $ telewatch command
    
  • Refresh interval
    $ telewatch -n 60 command
    
  • Daemonize
    $ telewatch -d command
    
  • Alert when command done
    make && telewatch alert -m "Hello world"
    

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFileNotExist = fmt.Errorf("token.yml file not found")
)

Functions

func Alert

func Alert(config TokenConfig, message string) error

func PrintErrorAndExit

func PrintErrorAndExit(msg string, err error)

func RegisterChatId

func RegisterChatId(config TokenConfig) error

func Watch

func Watch(config TokenConfig, interval int, command []string) error

Types

type TokenConfig

type TokenConfig struct {
	Token  string `yaml:"token"`
	ChatId int64  `yaml:"chatId"`
}

func LoadConfigurationFromHomeDirectory

func LoadConfigurationFromHomeDirectory() (TokenConfig, error)

func (TokenConfig) Save

func (config TokenConfig) Save() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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