Skip to content

Commit 4671166

Browse files
isaacrowntreeclaude
andcommitted
feat: default message commands to user token, add --as-bot flag
Messages sent via send/edit/delete now appear as the authenticated user by default. Pass --as-bot to use the bot identity instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2955cba commit 4671166

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

pkg/cmd/message/delete.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type deleteOptions struct {
1414
channel string
1515
ts string
1616
confirm bool
17+
asBot bool
1718
json cmdutil.JSONFlags
1819
}
1920

@@ -43,6 +44,7 @@ In non-interactive (piped) mode, --confirm is required.`,
4344
}
4445

4546
cmd.Flags().BoolVar(&opts.confirm, "confirm", false, "Skip confirmation prompt")
47+
cmd.Flags().BoolVar(&opts.asBot, "as-bot", false, "Delete as the bot instead of your user account")
4648
cmdutil.AddJSONFlags(cmd, &opts.json)
4749

4850
return cmd
@@ -52,7 +54,13 @@ func deleteRun(opts *deleteOptions) error {
5254
ios := opts.factory.IOStreams
5355
cs := ios.ColorScheme()
5456

55-
client, err := opts.factory.DefaultClient()
57+
var client *api.Client
58+
var err error
59+
if opts.asBot {
60+
client, err = opts.factory.DefaultClient()
61+
} else {
62+
client, err = opts.factory.UserClient()
63+
}
5664
if err != nil {
5765
return err
5866
}

pkg/cmd/message/edit.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type editOptions struct {
1717
channel string
1818
ts string
1919
text string
20+
asBot bool
2021
json cmdutil.JSONFlags
2122
}
2223

@@ -48,6 +49,7 @@ If new-text is omitted, reads from stdin (for piping).`,
4849
},
4950
}
5051

52+
cmd.Flags().BoolVar(&opts.asBot, "as-bot", false, "Edit as the bot instead of your user account")
5153
cmdutil.AddJSONFlags(cmd, &opts.json)
5254

5355
return cmd
@@ -57,7 +59,13 @@ func editRun(opts *editOptions) error {
5759
ios := opts.factory.IOStreams
5860
cs := ios.ColorScheme()
5961

60-
client, err := opts.factory.DefaultClient()
62+
var client *api.Client
63+
var err error
64+
if opts.asBot {
65+
client, err = opts.factory.DefaultClient()
66+
} else {
67+
client, err = opts.factory.UserClient()
68+
}
6169
if err != nil {
6270
return err
6371
}

pkg/cmd/message/send.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type sendOptions struct {
1717
channel string
1818
text string
1919
threadTS string
20+
asBot bool
2021
json cmdutil.JSONFlags
2122
}
2223

@@ -54,6 +55,7 @@ If text is omitted, reads from stdin (for piping).`,
5455
}
5556

5657
cmd.Flags().StringVar(&opts.threadTS, "thread-ts", "", "Thread timestamp to reply to")
58+
cmd.Flags().BoolVar(&opts.asBot, "as-bot", false, "Send as the bot instead of your user account")
5759
cmdutil.AddJSONFlags(cmd, &opts.json)
5860

5961
return cmd
@@ -63,7 +65,13 @@ func sendRun(opts *sendOptions) error {
6365
ios := opts.factory.IOStreams
6466
cs := ios.ColorScheme()
6567

66-
client, err := opts.factory.DefaultClient()
68+
var client *api.Client
69+
var err error
70+
if opts.asBot {
71+
client, err = opts.factory.DefaultClient()
72+
} else {
73+
client, err = opts.factory.UserClient()
74+
}
6775
if err != nil {
6876
return err
6977
}

0 commit comments

Comments
 (0)