Skip to content

Commit eeb4e74

Browse files
author
cuiko
committed
ref(msg): Name sticker-set action entry InstallStickerSet
Rename the action dispatcher from the noun StickerSet to the verb InstallStickerSet, matching the verb-first action-entry convention and the FaveSticker precedent (a positive verb that covers its inverse via a flag). No behavior change.
1 parent da9d01a commit eeb4e74

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

internal/action/message/sticker_set.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ type StickerSetQuery struct {
2424
// StickerSetFunc installs or uninstalls a sticker set.
2525
type StickerSetFunc func(context.Context, StickerSetQuery) (output.StickerSetResult, error)
2626

27-
// StickerSet validates the request and dispatches the install/uninstall.
28-
func StickerSet(ctx context.Context, req StickerSetRequest, do StickerSetFunc) (output.StickerSetResult, error) {
27+
// InstallStickerSet validates the request and dispatches the install/uninstall
28+
// (uninstall when req.Remove). Named for the positive verb, mirroring
29+
// FaveSticker, which likewise covers its inverse via a flag.
30+
func InstallStickerSet(ctx context.Context, req StickerSetRequest, do StickerSetFunc) (output.StickerSetResult, error) {
2931
name, err := parseStickerSetRef(req.RawSet)
3032
if err != nil {
3133
return output.StickerSetResult{}, err

internal/action/message/sticker_set_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestStickerSet_ParsesShortNameAndLinks(t *testing.T) {
2020
"https://telegram.me/addstickers/Animals",
2121
"https://t.me/addstickers/Animals?utm=x",
2222
} {
23-
_, err := actionmessage.StickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: in},
23+
_, err := actionmessage.InstallStickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: in},
2424
func(_ context.Context, q actionmessage.StickerSetQuery) (output.StickerSetResult, error) {
2525
require.Equal(t, "Animals", q.ShortName, in)
2626
require.False(t, q.Remove)
@@ -31,7 +31,7 @@ func TestStickerSet_ParsesShortNameAndLinks(t *testing.T) {
3131
}
3232

3333
func TestStickerSet_RemovePassesThrough(t *testing.T) {
34-
_, err := actionmessage.StickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: "Animals", Remove: true},
34+
_, err := actionmessage.InstallStickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: "Animals", Remove: true},
3535
func(_ context.Context, q actionmessage.StickerSetQuery) (output.StickerSetResult, error) {
3636
require.Equal(t, "Animals", q.ShortName)
3737
require.True(t, q.Remove)
@@ -41,7 +41,7 @@ func TestStickerSet_RemovePassesThrough(t *testing.T) {
4141
}
4242

4343
func TestStickerSet_RejectsEmptyRef(t *testing.T) {
44-
_, err := actionmessage.StickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: " "},
44+
_, err := actionmessage.InstallStickerSet(context.Background(), actionmessage.StickerSetRequest{RawSet: " "},
4545
func(context.Context, actionmessage.StickerSetQuery) (output.StickerSetResult, error) {
4646
t.Fatal("must not dispatch")
4747
return output.StickerSetResult{}, nil

internal/cli/msg/sticker/sticker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func newSet(f *runtime.Invocation, runF func(*SetOptions) error, remove bool, us
6565

6666
// RunSet dispatches install/uninstall.
6767
func RunSet(ctx context.Context, opts *SetOptions) error {
68-
res, err := actionmessage.StickerSet(ctx, actionmessage.StickerSetRequest{RawSet: opts.RawSet, Remove: opts.Remove}, opts.Do)
68+
res, err := actionmessage.InstallStickerSet(ctx, actionmessage.StickerSetRequest{RawSet: opts.RawSet, Remove: opts.Remove}, opts.Do)
6969
if err != nil {
7070
return err
7171
}

0 commit comments

Comments
 (0)