### Get Chatroom Info (API v1) - Go Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves chatroom configuration using the older API v1 format. It fetches basic chat settings, user information, and channel emotes. Requires the kickcom library. ```go package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // Get chatroom by channel slug chatroom, err := k.GetChatroomV1(ctx, "xqc") if err != nil { log.Fatalf("Failed to get chatroom: %v", err) } fmt.Printf("Chatroom ID: %d\n", chatroom.ID) fmt.Printf("User ID: %d\n", chatroom.UserID) fmt.Printf("Slug: %s\n", chatroom.Slug) fmt.Printf("Is Banned: %v\n", chatroom.IsBanned) fmt.Printf("VOD Enabled: %v\n", chatroom.VodEnabled) fmt.Printf("Can Host: %v\n", chatroom.CanHost) // Chat settings fmt.Printf("Slow Mode: %v\n", chatroom.Chatroom.SlowMode) fmt.Printf("Followers Mode: %v\n", chatroom.Chatroom.FollowersMode) fmt.Printf("Subscribers Mode: %v\n", chatroom.Chatroom.SubscribersMode) fmt.Printf("Emotes Mode: %v\n", chatroom.Chatroom.EmotesMode) fmt.Printf("Message Interval: %d\n", chatroom.Chatroom.MessageInterval) // List channel emotes fmt.Printf("Available Emotes: %d\n", len(chatroom.Emotes)) for _, emote := range chatroom.Emotes { fmt.Printf(" - %s (ID: %d, Subs Only: %v)\n", emote.Name, emote.ID, emote.SubscribersOnly) } enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") enc.Encode(chatroom) } ``` -------------------------------- ### Get Chatroom Info (API v2) - Go Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves chatroom configuration using the newer API v2 format. This version includes advanced settings like bot protection, quick emotes, banners, and gift settings. Requires the kickcom library. ```go package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // Get chatroom using API v2 chatroom, err := k.GetChatroomV2(ctx, "xqc") if err != nil { log.Fatalf("Failed to get chatroom: %v", err) } fmt.Printf("Chatroom ID: %d\n", chatroom.ID) // Slow mode settings fmt.Printf("Slow Mode Enabled: %v\n", chatroom.SlowMode.Enabled) fmt.Printf("Message Interval: %d seconds\n", chatroom.SlowMode.MessageInterval) // Subscribers mode fmt.Printf("Subscribers Mode: %v\n", chatroom.SubscribersMode.Enabled) // Followers mode fmt.Printf("Followers Mode: %v\n", chatroom.FollowersMode.Enabled) fmt.Printf("Min Follow Duration: %d\n", chatroom.FollowersMode.MinDuration) // Emotes mode fmt.Printf("Emotes Mode: %v\n", chatroom.EmotesMode.Enabled) // Advanced bot protection fmt.Printf("Bot Protection: %v\n", chatroom.AdvancedBotProtection.Enabled) fmt.Printf("Bot Protection Time Remaining: %d\n", chatroom.AdvancedBotProtection.RemainingTime) // UI settings fmt.Printf("Show Quick Emotes: %v\n", chatroom.ShowQuickEmotes.Enabled) fmt.Printf("Show Banners: %v\n", chatroom.ShowBanners.Enabled) // Gift settings fmt.Printf("Gifts Enabled: %v\n", chatroom.GiftsEnabled.Enabled) fmt.Printf("Gifts Week Enabled: %v\n", chatroom.GiftsWeekEnabled.Enabled) fmt.Printf("Gifts Month Enabled: %v\n", chatroom.GiftsMonthEnabled.Enabled) enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") enc.Encode(chatroom) } ``` -------------------------------- ### Get Chatroom Rules (API v2) - Go Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves the custom chat rules set by a channel owner as a text string. This function uses API v2 and returns the channel's guidelines for participants. Requires the kickcom library. ```go package main import ( "context" "fmt" "log" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // Get chatroom rules rules, err := k.GetChatroomRulesV2(ctx, "xqc") if err != nil { log.Fatalf("Failed to get chatroom rules: %v", err) } // Check response status if rules.Status.Error { fmt.Printf("Error: %s (code %d)\n", rules.Status.Message, rules.Status.Code) return } fmt.Println("Chat Rules:") fmt.Println("===========") fmt.Println(rules.Data.Rules) } // Example output: // Chat Rules: // =========== // 1. Be respectful to everyone // 2. No spam or self-promotion // 3. No hate speech or harassment // 4. English only in chat // 5. Follow Kick.com Terms of Service ``` -------------------------------- ### Get Kick.com Chat Messages (Go) Source: https://github.com/xaionaro-go/kickcom/blob/main/README.md This Go code snippet demonstrates how to use the kickcom package to fetch chat messages for a specific Kick.com channel. It requires the channel slug as input and returns a list of messages. Dependencies include the kickcom and go-spew packages. ```go package main import "github.com/davecgh/go-spew/spew" import "github.com/xaionaro-go/kickcom" func main() { ... k, err := kickcom.New() if err != nil { ... } channel, err := k.GetChannelV1(ctx, channelSlug) if err != nil { ... } reply, err := k.GetChatMessagesV2(ctx, channel.ID, 0) if err != nil { ... } for _, msg := range reply.Data.Messages { spew.Dump(msg) } ... } ``` -------------------------------- ### Get Livestream Status with kickcom in Go Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves current livestream information for a channel using the GetLivestreamV2 function. It requires a channel slug as input and returns details like viewer count, stream title, playback URL, and thumbnail. The function returns nil data if the channel is not live. ```go package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // Get livestream status by channel slug streamInfo, err := k.GetLivestreamV2(ctx, "xqc") if err != nil { log.Fatalf("Failed to get livestream: %v", err) } // Check if stream is live if streamInfo.Data == nil { fmt.Println("Channel is not currently live") return } // Access livestream data stream := streamInfo.Data fmt.Printf("Stream ID: %d\n", stream.ID) fmt.Printf("Title: %s\n", stream.SessionTitle) fmt.Printf("Viewers: %d\n", stream.Viewers) fmt.Printf("Language: %s\n", stream.Language) fmt.Printf("Is Mature: %v\n", stream.IsMature) fmt.Printf("Playback URL: %s\n", stream.PlaybackURL) fmt.Printf("Category: %s\n", stream.Category.Name) fmt.Printf("Thumbnail: %s\n", stream.Thumbnail.Src) fmt.Printf("Started At: %s\n", stream.CreatedAt) // Output full response as JSON enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") enc.Encode(streamInfo) } ``` -------------------------------- ### Get Chat Messages with kickcom in Go Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves chat message history for a channel using the GetChatMessagesV2 function. This function requires the channel ID, which can be obtained using GetChannelV1. It returns messages with sender information, content, timestamps, and user identity badges. The function also provides pagination cursors and information about pinned messages. ```go package main import ( "context" "fmt" "log" "time" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // First get channel to obtain channel ID channel, err := k.GetChannelV1(ctx, "xqc") if err != nil { log.Fatal(err) } // Get chat messages using channel ID (cursor 0 for latest) reply, err := k.GetChatMessagesV2(ctx, channel.ID, 0) if err != nil { log.Fatalf("Failed to get chat messages: %v", err) } // Check response status if reply.Status.Error { fmt.Printf("Error: %s (code %d)\n", reply.Status.Message, reply.Status.Code) return } if reply.Status.Message == "No messages found" { fmt.Println("No messages in chat history") return } // Iterate through messages for _, msg := range reply.Data.Messages { fmt.Printf("[%s] %s: %s\n", msg.CreatedAt.Format(time.RFC3339), msg.Sender.Username, msg.Content, ) // Access sender identity (badges, color) fmt.Printf(" - User ID: %d\n", msg.UserID) fmt.Printf(" - Chat Color: %s\n", msg.Sender.Identity.Color) fmt.Printf(" - Badges: %d\n", len(msg.Sender.Identity.Badges)) } // Access pagination cursor fmt.Printf("Next cursor: %s\n", reply.Data.Cursor) // Check for pinned message if reply.Data.PinnedMessage != nil { fmt.Println("Channel has a pinned message") } } ``` -------------------------------- ### Initialize Kick API Client with Cloudflare Bypass Source: https://context7.com/xaionaro-go/kickcom/llms.txt Initializes a new Kick API client, automatically handling Cloudflare bypass and cookie jar management. This function is the primary entry point for all interactions with the Kick.com API. ```go package main import ( "context" "log" "github.com/xaionaro-go/kickcom" ) func main() { // Create a new Kick client with Cloudflare bypass k, err := kickcom.New() if err != nil { log.Fatalf("Failed to create Kick client: %v", err) } // The client is now ready to make API requests ctx := context.Background() // Example: Get channel information channel, err := k.GetChannelV1(ctx, "xqc") if err != nil { log.Fatalf("Failed to get channel: %v", err) } log.Printf("Channel ID: %d, Followers: %d", channel.ID, channel.FollowersCount) } ``` -------------------------------- ### Monitor Channel Chat in Real-Time Source: https://context7.com/xaionaro-go/kickcom/llms.txt Demonstrates how to poll the Kick.com API to monitor chat messages for a specific channel. It uses a ticker to fetch messages periodically and maintains a local state to filter out duplicate messages. ```go package main import ( "context" "fmt" "log" "time" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() channelSlug := "xqc" k, err := kickcom.New() if err != nil { log.Fatal(err) } channel, err := k.GetChannelV1(ctx, channelSlug) if err != nil { log.Fatal(err) } fmt.Printf("Monitoring chat for: %s (ID: %d)\n", channel.User.Username, channel.ID) seenMessages := make(map[string]bool) ticker := time.NewTicker(time.Second) defer ticker.Stop() for { select { case <-ticker.C: reply, err := k.GetChatMessagesV2(ctx, channel.ID, 0) if err != nil { log.Printf("Error fetching messages: %v", err) continue } for i := len(reply.Data.Messages) - 1; i >= 0; i-- { msg := reply.Data.Messages[i] if !seenMessages[msg.ID] { seenMessages[msg.ID] = true fmt.Printf("%s %s: %s\n", msg.CreatedAt.Format("15:04:05"), msg.Sender.Username, msg.Content) } } case <-ctx.Done(): return } } } ``` -------------------------------- ### Retrieve Streaming Categories with Kick.com Go Library Source: https://context7.com/xaionaro-go/kickcom/llms.txt Fetches a comprehensive list of all available streaming categories and subcategories on Kick.com. This is useful for building category-based browsers or validating user input against official platform categories. ```go package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } categories, err := k.GetSubcategoriesV1(ctx) if err != nil { log.Fatalf("Failed to get categories: %v", err) } fmt.Printf("Total categories: %d\n\n", len(*categories)) for i, cat := range *categories { fmt.Printf("%d. %s\n", i+1, cat.Name) fmt.Printf(" Slug: %s\n", cat.Slug) fmt.Printf(" ID: %d\n", cat.ID) fmt.Printf(" Mature: %v\n", cat.IsMature) if cat.Icon != "" { fmt.Printf(" Icon: %s\n", cat.Icon) } fmt.Println() if i >= 9 { fmt.Printf("... and %d more categories\n", len(*categories)-10) break } } enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") enc.Encode(categories) } ``` -------------------------------- ### Retrieve Kick Channel Information (V1 API) Source: https://context7.com/xaionaro-go/kickcom/llms.txt Retrieves detailed information about a Kick.com channel using its username (slug). This includes user details, chatroom settings, livestream status, and subscription information. The response is a Go struct containing comprehensive channel data. ```go package main import ( "context" "encoding/json" "fmt" "log" "os" "github.com/xaionaro-go/kickcom" ) func main() { ctx := context.Background() k, err := kickcom.New() if err != nil { log.Fatal(err) } // Get channel by slug (username) channel, err := k.GetChannelV1(ctx, "xqc") if err != nil { log.Fatalf("Failed to get channel: %v", err) } // Access channel data fmt.Printf("Channel ID: %d\n", channel.ID) fmt.Printf("Username: %s\n", channel.User.Username) fmt.Printf("Followers: %d\n", channel.FollowersCount) fmt.Printf("Is Banned: %v\n", channel.IsBanned) fmt.Printf("VOD Enabled: %v\n", channel.VodEnabled) fmt.Printf("Subscription Enabled: %v\n", channel.SubscriptionEnabled) fmt.Printf("Playback URL: %s\n", channel.PlaybackURL) // Access nested user info fmt.Printf("Bio: %s\n", channel.User.Bio) fmt.Printf("Profile Pic: %s\n", channel.User.ProfilePic) // Access chatroom settings fmt.Printf("Chatroom ID: %d\n", channel.Chatroom.ID) fmt.Printf("Slow Mode: %v\n", channel.Chatroom.SlowMode) fmt.Printf("Followers Mode: %v\n", channel.Chatroom.FollowersMode) // Check if currently live if channel.Livestream.IsLive { fmt.Printf("Currently Live: %s\n", channel.Livestream.SessionTitle) fmt.Printf("Viewers: %d\n", channel.Livestream.ViewerCount) } // Output full response as JSON enc := json.NewEncoder(os.Stdout) enc.SetIndent("", " ") enc.Encode(channel) } // Expected output: // Channel ID: 668 // Username: xQc // Followers: 1500000 // Is Banned: false // ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.