diff --git a/bot.go b/bot.go index 319eca1..6f92517 100644 --- a/bot.go +++ b/bot.go @@ -95,12 +95,12 @@ func handleStartCmd(c tele.Context) error { func handleTrafficCmd(c tele.Context) error { dailyTraffic, err := stats.VnstatDailyTraffic(config.WatchedInterface) if err != nil { - _ = c.Reply(stickerFromID(stickerPanic)) + _ = c.Reply(stickerFromID(stickerPanic), tele.Silent) return err } monthlyTraffic, err := stats.VnstatMonthlyTraffic(config.WatchedInterface) if err != nil { - _ = c.Reply(stickerFromID(stickerPanic)) + _ = c.Reply(stickerFromID(stickerPanic), tele.Silent) return err } @@ -137,7 +137,7 @@ func handleTrafficCmd(c tele.Context) error { respText = strings.Join(responseParts, "\n") } - return c.Reply(respText, &tele.SendOptions{ParseMode: tele.ModeMarkdown}) + return c.Reply(respText, &tele.SendOptions{ParseMode: tele.ModeMarkdown}, tele.Silent) } func fmtTraffic(r stats.VnstatTrafficRecord) string { @@ -148,7 +148,7 @@ func fmtTraffic(r stats.VnstatTrafficRecord) string { func handleUserInfoCmd(c tele.Context) error { u := c.Sender() if u == nil { - return c.Reply("Unknown.") + return c.Reply("Unknown.", tele.Silent) } replyText := []string{ @@ -163,13 +163,13 @@ func handleUserInfoCmd(c tele.Context) error { fmt.Sprintf(`IsPremium: %t`, u.IsPremium), "```", } - return c.Reply(strings.Join(replyText, "\n"), &tele.SendOptions{ParseMode: tele.ModeMarkdown}) + return c.Reply(strings.Join(replyText, "\n"), &tele.SendOptions{ParseMode: tele.ModeMarkdown}, tele.Silent) } func handleChatInfoCmd(c tele.Context) error { chat := c.Chat() if chat == nil { - return c.Reply("Unknown.") + return c.Reply("Unknown.", tele.Silent) } loc := "" if chat.ChatLocation != nil { @@ -195,7 +195,7 @@ func handleChatInfoCmd(c tele.Context) error { fmt.Sprintf(`NoVoiceAndVideo: %t`, chat.NoVoiceAndVideo), "```", } - return c.Reply(strings.Join(replyText, "\n"), &tele.SendOptions{ParseMode: tele.ModeMarkdown}) + return c.Reply(strings.Join(replyText, "\n"), &tele.SendOptions{ParseMode: tele.ModeMarkdown}, tele.Silent) } func drawBar(progress float64, length int) string { @@ -234,7 +234,7 @@ func handleYearProgressCmd(c tele.Context) error { "\n%d is %2.0f%% complete.\n
%s
", time.Now().Year(), ratio*100, drawBar(ratio, 25), ) - return c.Reply(replyText, &tele.SendOptions{ParseMode: tele.ModeHTML}) + return c.Reply(replyText, &tele.SendOptions{ParseMode: tele.ModeHTML}, tele.Silent) } func handleGeneralMessage(_ tele.Context) error { @@ -258,12 +258,16 @@ func handleDigCmd(c tele.Context) error { req, err := cmds.NewDigRequest(msg.Payload) if err != nil { - return c.Reply("Invalid arguments.\nUsage: `/dig [type]`", &tele.SendOptions{ParseMode: tele.ModeMarkdown}) + return c.Reply( + "Invalid arguments.\nUsage: `/dig [type]`", + &tele.SendOptions{ParseMode: tele.ModeMarkdown}, + tele.Silent, + ) } resp, err := cmds.Dig(req) if err != nil { - _ = c.Reply(stickerFromID(stickerPanic)) + _ = c.Reply(stickerFromID(stickerPanic), tele.Silent) return err } @@ -286,5 +290,5 @@ func handleDigCmd(c tele.Context) error { html.EscapeString(replyBuf.String()), "", } - return c.Reply(strings.Join(replyText, ""), &tele.SendOptions{ParseMode: tele.ModeHTML}) + return c.Reply(strings.Join(replyText, ""), &tele.SendOptions{ParseMode: tele.ModeHTML}, tele.Silent) }