Skip to content

Commit 6e10296

Browse files
committed
chore: add pin_latest config
1 parent dfc336f commit 6e10296

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

main.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ func sendPVEStatusToTelegram(text string, temp float64, conf *Config) error {
132132
return fmt.Errorf("request failed with status code: %s", resp.Status)
133133
}
134134

135+
if !conf.PinLatest {
136+
return nil
137+
}
138+
135139
var respData struct {
136140
Result struct {
137141
MessageId int64 `json:"message_id"`
@@ -191,7 +195,7 @@ func pinMessageToTelegram(conf *Config, messageId int64) error {
191195
return err
192196
}
193197
defer resp.Body.Close()
194-
198+
195199
return nil
196200
}
197201

@@ -223,8 +227,9 @@ func loadConfig(path string) (*Config, error) {
223227
}
224228

225229
type Config struct {
226-
Token string `json:"token"`
227-
TargetId int64 `json:"target_id"`
230+
Token string `json:"token"`
231+
TargetId int64 `json:"target_id"`
232+
PinLatest bool `json:"pin_latest"`
228233
}
229234

230235
func main() {

0 commit comments

Comments
 (0)