Disable write operations in dry run mode for safety

- Commented out SendDraft and ReadHistory calls in dry run mode
- This prevents accidental message sending when testing configuration
- Read-only mode should truly be read-only
This commit is contained in:
michaotic 2026-04-12 02:40:16 +03:00
parent 1c2c03a792
commit 359e8dbc79

View file

@ -70,19 +70,20 @@ func serve(ctx context.Context, cmd *cli.Command) error {
log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check GetHistory: OK")
answer, err = client.SendDraft(tg.DraftArguments{Name: os.Getenv("TG_TEST_USERNAME"), Text: "test draft"})
if err != nil {
log.Err(err).Msg("Check SendDraft: FAIL")
} else {
log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check SendDraft: OK")
}
// Disabled write operations in dry run mode for safety
// answer, err = client.SendDraft(tg.DraftArguments{Name: os.Getenv("TG_TEST_USERNAME"), Text: "test draft"})
// if err != nil {
// log.Err(err).Msg("Check SendDraft: FAIL")
// } else {
// log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check SendDraft: OK")
// }
answer, err = client.ReadHistory(tg.ReadArguments{Name: os.Getenv("TG_TEST_USERNAME")})
if err != nil {
log.Err(err).Msg("Check ReadHistory: FAIL")
} else {
log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check ReadHistory: OK")
}
// answer, err = client.ReadHistory(tg.ReadArguments{Name: os.Getenv("TG_TEST_USERNAME")})
// if err != nil {
// log.Err(err).Msg("Check ReadHistory: FAIL")
// } else {
// log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check ReadHistory: OK")
// }
return nil
}