|
|
@ -29,6 +29,7 @@ var (
|
|
|
|
configFile string
|
|
|
|
configFile string
|
|
|
|
chatID string
|
|
|
|
chatID string
|
|
|
|
token string
|
|
|
|
token string
|
|
|
|
|
|
|
|
parse_mode string
|
|
|
|
timeout int
|
|
|
|
timeout int
|
|
|
|
silent bool
|
|
|
|
silent bool
|
|
|
|
versionFlag bool
|
|
|
|
versionFlag bool
|
|
|
@ -39,6 +40,7 @@ func init() {
|
|
|
|
pflag.StringVarP(&configFile, "config", "f", "", "Configuration file path")
|
|
|
|
pflag.StringVarP(&configFile, "config", "f", "", "Configuration file path")
|
|
|
|
pflag.StringVarP(&chatID, "chatid", "c", "", "Chat ID value")
|
|
|
|
pflag.StringVarP(&chatID, "chatid", "c", "", "Chat ID value")
|
|
|
|
pflag.StringVarP(&token, "token", "t", "", "Bot token value")
|
|
|
|
pflag.StringVarP(&token, "token", "t", "", "Bot token value")
|
|
|
|
|
|
|
|
pflag.StringVarP(&parse_mode, "parse", "p", "MarkdownV2", "Telegram message parse mode")
|
|
|
|
pflag.IntVarP(&timeout, "timeout", "", 10, "Timeout value")
|
|
|
|
pflag.IntVarP(&timeout, "timeout", "", 10, "Timeout value")
|
|
|
|
pflag.BoolVarP(&silent, "silent", "s", false, "Disable notification sound")
|
|
|
|
pflag.BoolVarP(&silent, "silent", "s", false, "Disable notification sound")
|
|
|
|
pflag.BoolVarP(&versionFlag, "version", "v", false, "Print version information and exit")
|
|
|
|
pflag.BoolVarP(&versionFlag, "version", "v", false, "Print version information and exit")
|
|
|
@ -155,6 +157,7 @@ func main() {
|
|
|
|
data.Set("disable_notification", "true")
|
|
|
|
data.Set("disable_notification", "true")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.Set("text", message)
|
|
|
|
data.Set("text", message)
|
|
|
|
|
|
|
|
data.Set("parse_mode", parse_mode)
|
|
|
|
|
|
|
|
|
|
|
|
client := &http.Client{
|
|
|
|
client := &http.Client{
|
|
|
|
Timeout: time.Duration(config.Timeout) * time.Second,
|
|
|
|
Timeout: time.Duration(config.Timeout) * time.Second,
|
|
|
|