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")
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue