✨ Support list super chat event

This commit is contained in:
chaoqun committed 2024-08-31 22:25:08 +08:00
1 parent 6c22e93ddc
commit a15ddcf985
3 files changed
+59

No files matched your search

+32
View File
@@ -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
View File
@@ -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
View File
@@ -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"