Skip to content

Commit a15ddcf

Browse files
committed
✨ Support list super chat event
1 parent 6c22e93 commit a15ddcf

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

cmd/superChatEvent/list.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package superChatEvent
2+
3+
import (
4+
"github.com/eat-pray-ai/yutu/pkg/superChatEvent"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var listCmd = &cobra.Command{
9+
Use: "list",
10+
Short: "List Super Chat events for a channel",
11+
Long: "List Super Chat events for a channel",
12+
Run: func(cmd *cobra.Command, args []string) {
13+
sc := superChatEvent.NewSuperChatEvent(
14+
superChatEvent.WithHl(hl),
15+
superChatEvent.WithMaxResults(maxResults),
16+
)
17+
sc.List(parts, output)
18+
},
19+
}
20+
21+
func init() {
22+
superChatEventCmd.AddCommand(listCmd)
23+
24+
listCmd.Flags().StringVarP(
25+
&hl, "hl", "l", "", "Return rendered funding amounts in specified language",
26+
)
27+
listCmd.Flags().Int64VarP(
28+
&maxResults, "maxResults", "n", 5, "The maximum number of items that should be returned",
29+
)
30+
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "snippet"}, "Comma separated parts")
31+
listCmd.Flags().StringVarP(&output, "output", "o", "", "json or yaml")
32+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package superChatEvent
2+
3+
import (
4+
"github.com/eat-pray-ai/yutu/cmd"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var (
9+
hl string
10+
maxResults int64
11+
parts []string
12+
output string
13+
)
14+
15+
var superChatEventCmd = &cobra.Command{
16+
Use: "superChatEvent",
17+
Short: "List Super Chat events for a channel",
18+
Long: "List Super Chat events for a channel",
19+
Run: func(cmd *cobra.Command, args []string) {
20+
cmd.Help()
21+
},
22+
}
23+
24+
func init() {
25+
cmd.RootCmd.AddCommand(superChatEventCmd)
26+
}

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
_ "github.com/eat-pray-ai/yutu/cmd/playlistItem"
1818
_ "github.com/eat-pray-ai/yutu/cmd/search"
1919
_ "github.com/eat-pray-ai/yutu/cmd/subscription"
20+
_ "github.com/eat-pray-ai/yutu/cmd/superChatEvent"
2021
_ "github.com/eat-pray-ai/yutu/cmd/thumbnail"
2122
_ "github.com/eat-pray-ai/yutu/cmd/video"
2223
_ "github.com/eat-pray-ai/yutu/cmd/videoAbuseReportReason"

0 commit comments

Comments
 (0)