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:
parent
1c2c03a792
commit
359e8dbc79
1 changed files with 13 additions and 12 deletions
25
serve.go
25
serve.go
|
|
@ -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")
|
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"})
|
// Disabled write operations in dry run mode for safety
|
||||||
if err != nil {
|
// answer, err = client.SendDraft(tg.DraftArguments{Name: os.Getenv("TG_TEST_USERNAME"), Text: "test draft"})
|
||||||
log.Err(err).Msg("Check SendDraft: FAIL")
|
// if err != nil {
|
||||||
} else {
|
// log.Err(err).Msg("Check SendDraft: FAIL")
|
||||||
log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check SendDraft: OK")
|
// } 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")})
|
// answer, err = client.ReadHistory(tg.ReadArguments{Name: os.Getenv("TG_TEST_USERNAME")})
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
log.Err(err).Msg("Check ReadHistory: FAIL")
|
// log.Err(err).Msg("Check ReadHistory: FAIL")
|
||||||
} else {
|
// } else {
|
||||||
log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check ReadHistory: OK")
|
// log.Info().RawJSON("answer", []byte(answer.Content[0].TextContent.Text)).Msg("Check ReadHistory: OK")
|
||||||
}
|
// }
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue