Skip to content

Commit

Permalink
✨ Support list super chat event
Browse files Browse the repository at this point in the history
  • Loading branch information
OpenWaygate committed Aug 31, 2024
1 parent 6c22e93 commit a15ddcf
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
32 changes: 32 additions & 0 deletions cmd/superChatEvent/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package superChatEvent

import (
"github.com/eat-pray-ai/yutu/pkg/superChatEvent"
"github.com/spf13/cobra"
)

var listCmd = &cobra.Command{
Use: "list",
Short: "List Super Chat events for a channel",
Long: "List Super Chat events for a channel",
Run: func(cmd *cobra.Command, args []string) {
sc := superChatEvent.NewSuperChatEvent(
superChatEvent.WithHl(hl),
superChatEvent.WithMaxResults(maxResults),
)
sc.List(parts, output)
},
}

func init() {
superChatEventCmd.AddCommand(listCmd)

listCmd.Flags().StringVarP(
&hl, "hl", "l", "", "Return rendered funding amounts in specified language",
)
listCmd.Flags().Int64VarP(
&maxResults, "maxResults", "n", 5, "The maximum number of items that should be returned",
)
listCmd.Flags().StringSliceVarP(&parts, "parts", "p", []string{"id", "snippet"}, "Comma separated parts")
listCmd.Flags().StringVarP(&output, "output", "o", "", "json or yaml")
}
26 changes: 26 additions & 0 deletions cmd/superChatEvent/superChatEvent.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package superChatEvent

import (
"github.com/eat-pray-ai/yutu/cmd"
"github.com/spf13/cobra"
)

var (
hl string
maxResults int64
parts []string
output string
)

var superChatEventCmd = &cobra.Command{
Use: "superChatEvent",
Short: "List Super Chat events for a channel",
Long: "List Super Chat events for a channel",
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}

func init() {
cmd.RootCmd.AddCommand(superChatEventCmd)
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
_ "github.com/eat-pray-ai/yutu/cmd/playlistItem"
_ "github.com/eat-pray-ai/yutu/cmd/search"
_ "github.com/eat-pray-ai/yutu/cmd/subscription"
_ "github.com/eat-pray-ai/yutu/cmd/superChatEvent"
_ "github.com/eat-pray-ai/yutu/cmd/thumbnail"
_ "github.com/eat-pray-ai/yutu/cmd/video"
_ "github.com/eat-pray-ai/yutu/cmd/videoAbuseReportReason"
Expand Down

0 comments on commit a15ddcf

Please # to comment.