{"_id":"@botk4cp3r/kick.js","_rev":"1-82690d75669c30f1f0cc5319ed51e7a8","name":"@botk4cp3r/kick.js","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@botk4cp3r/kick.js","version":"1.0.0","keywords":["kick","kickapi","kickcom","api"],"author":{"name":"botk4cp3r"},"license":"MIT","_id":"@botk4cp3r/kick.js@1.0.0","maintainers":[{"name":"botk4cp3r","email":"kontakt.n4rmoo@gmail.com"}],"homepage":"https://github.com/BOT-K4CP3R/kick.api#readme","bugs":{"url":"https://github.com/BOT-K4CP3R/kick.api/issues"},"dist":{"shasum":"1501cff5d41876e2b40da7cae5a56a28ca80cee2","tarball":"https://registry.npmjs.org/@botk4cp3r/kick.js/-/kick.js-1.0.0.tgz","fileCount":16,"integrity":"sha512-N8R2IcJ22y+jhdZOApMS14XUi5Og7b2FdYr0xdJ1yRNuBWsHksYFPYI79QyOhlwRDzjjmenKBrzBvzWoYwUwKw==","signatures":[{"sig":"MEQCIBY8gp4EcB0u+Hg+WKTQrr75jrkOYqY5zHxB09G2OsqrAiAN4BX1vF+sDe4R72ToxRLwthaC41rzKDh/Qvrj9hYcmA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38664},"main":"index.js","gitHead":"6dbe0aff0b868875f63169652389af0408c6dc8a","_npmUser":{"name":"botk4cp3r","email":"kontakt.n4rmoo@gmail.com"},"repository":{"url":"git+https://github.com/BOT-K4CP3R/kick.api.git","type":"git"},"_npmVersion":"10.9.2","description":"Node.js client for Kick.com API","directories":{},"_nodeVersion":"22.13.1","dependencies":{"express":"^4.21.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/kick.js_1.0.0_1740000604417_0.94482824355049","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@botk4cp3r/kick.js","version":"1.0.1","description":"Node.js client for Kick.com API","main":"index.js","repository":{"type":"git","url":"git+https://github.com/BOT-K4CP3R/kick.api.git"},"keywords":["kick","kickapi","kickcom","api"],"author":{"name":"botk4cp3r"},"license":"MIT","bugs":{"url":"https://github.com/BOT-K4CP3R/kick.api/issues"},"homepage":"https://github.com/BOT-K4CP3R/kick.api#readme","dependencies":{"express":"^4.21.2"},"_id":"@botk4cp3r/kick.js@1.0.1","gitHead":"bef691056eaa31e92d3c83848d080f9bcd18908d","_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-mvga4Z6mSI9Bvf2T08GDQSImSbZmaJx3Yzf9P4RD3nqa3mrtKHjK8cNiVe9DvkpAHwKJd2NoLiBPtucOmhd1wA==","shasum":"2bbdf12bfc3a9e24d475904a1b1a171550c4be15","tarball":"https://registry.npmjs.org/@botk4cp3r/kick.js/-/kick.js-1.0.1.tgz","fileCount":16,"unpackedSize":38759,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC1C36w0O/se1//PRFQ20vwaoSnDjItq9KDhceeN5C3XwIhAJ0s9dJJPq70mwfspCre+ufX4QKaQW2Nx6Om5RA7CUaw"}]},"_npmUser":{"name":"botk4cp3r","email":"kontakt.n4rmoo@gmail.com"},"directories":{},"maintainers":[{"name":"botk4cp3r","email":"kontakt.n4rmoo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kick.js_1.0.1_1740057491122_0.6570378323886312"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-19T21:30:04.342Z","modified":"2025-02-20T13:18:11.512Z","1.0.0":"2025-02-19T21:30:04.634Z","1.0.1":"2025-02-20T13:18:11.349Z"},"bugs":{"url":"https://github.com/BOT-K4CP3R/kick.api/issues"},"author":{"name":"botk4cp3r"},"license":"MIT","homepage":"https://github.com/BOT-K4CP3R/kick.api#readme","keywords":["kick","kickapi","kickcom","api"],"repository":{"type":"git","url":"git+https://github.com/BOT-K4CP3R/kick.api.git"},"description":"Node.js client for Kick.com API","maintainers":[{"name":"botk4cp3r","email":"kontakt.n4rmoo@gmail.com"}],"readme":"# Kick.com API Client\r\n\r\n[![NPM Version](https://img.shields.io/npm/v/@botk4cp3r/kick.js)](https://www.npmjs.com/package/@botk4cp3r/kick.js)\r\n[![License](https://img.shields.io/npm/l/@botk4cp3r/kick.js)](https://github.com/BOT-K4CP3R/kick.api/blob/main/LICENSE)\r\n\r\n## 📋 Table of Contents\r\n- [Installation](#-installation)\r\n- [Quick Start](#-quick-start)\r\n- [Chat System](#-chat-system)\r\n- [Webhook Events](#-webhook-events)\r\n- [Channel Management](#-channel-management)\r\n- [Category System](#-category-system)\r\n- [User Management](#-user-management)\r\n- [Error Handling](#-error-handling)\r\n- [TypeScript Support](#-typescript-support)\r\n- [Examples](#-examples)\r\n\r\n## 📥 Installation\r\n\r\n```bash\r\nnpm install @botk4cp3r/kick.jsapi\r\n# or\r\nyarn add @botk4cp3r/kick.js\r\n# or\r\npnpm add @botk4cp3r/kick.js\r\n```\r\n\r\n## 🚀 Quick Start\r\n\r\n```javascript\r\nconst { KickClient } = require('@botk4cp3r/kick.js');\r\n\r\n// Create client instance\r\nconst client = new KickClient({\r\n    token: 'your-api-token',\r\n    webhookPort: 3000,\r\n    webhookPath: '/webhook',\r\n    webhookBaseUrl: 'http://your-domain.com'\r\n});\r\n\r\n// Start webhook server and subscribe to events\r\nasync function init() {\r\n    await client.startWebhookServer();\r\n    \r\n    // Subscribe to all available events\r\n    await client.subscribeToEvents([\r\n        'chat.message.sent',\r\n        'channel.followed',\r\n        'channel.subscription.new',\r\n        'channel.subscription.renewal',\r\n        'channel.subscription.gifts'\r\n    ]);\r\n    \r\n    console.log('Bot is ready!');\r\n}\r\n\r\n// Listen for events\r\nclient.on('chatMessage', message => {\r\n    console.log(`${message.sender.username}: ${message.content}`);\r\n});\r\n\r\nclient.on('channelFollowed', data => {\r\n    console.log(`New follower: ${data.follower.username}!`);\r\n});\r\n\r\nclient.on('subscriptionNew', data => {\r\n    console.log(`New sub: ${data.subscriber.username}!`);\r\n});\r\n\r\n// Send a chat message\r\nawait client.sendChatMessage({\r\n    content: 'Hello World!',\r\n    type: 'bot'\r\n});\r\n\r\ninit().catch(console.error);\r\n```\r\n\r\n## 💬 Chat System\r\n\r\n### Send Bot Messages\r\n```javascript\r\n// Simple bot message\r\nawait client.sendChatMessage({\r\n    content: 'Hello from bot!',\r\n    type: 'bot'\r\n});\r\n\r\n// Simple user message\r\nawait client.sendChatMessage({\r\n    content: 'Hello! Kappa',\r\n    type: 'user',\r\n    broadcasterUserId: '123456'\r\n});\r\n```\r\n\r\n### Listen for Chat Events\r\n```javascript\r\n// New messages\r\nclient.on('chatMessage', msg => {\r\n    console.log(`${msg.sender.username}: ${msg.content}`);\r\n    \r\n    // Auto-respond to commands\r\n    if (msg.content === '!ping') {\r\n        client.sendChatMessage({\r\n            content: 'Pong! 🏓',\r\n            type: 'bot'\r\n        });\r\n    }\r\n});\r\n```\r\n\r\n## 📡 Webhook Events\r\n\r\n### Start Webhook Server\r\n```javascript\r\nconst client = new KickClient({\r\n    token: 'your-api-token',\r\n    webhookPort: 3000,\r\n    webhookPath: '/webhook',\r\n    webhookBaseUrl: 'http://your-domain.com'\r\n});\r\n\r\nawait client.startWebhookServer();\r\n```\r\n\r\n### Subscribe to Events\r\n```javascript\r\n// Subscribe to specific events\r\nawait client.subscribeToEvents([\r\n    'chat.message.sent',\r\n    'channel.followed',\r\n    'subscription.new',\r\n    'channel.subscription.renewal',\r\n    'channel.subscription.gifts'\r\n]);\r\n\r\n// Listen for events\r\nclient.on('channelFollowed', data => {\r\n    console.log(`New follower: ${data.follower.username}`);\r\n});\r\n\r\nclient.on('subscriptionNew', data => {\r\n    console.log(`New sub: ${data.subscriber.username}`);\r\n});\r\n```\r\n\r\n### Custom Event Handlers\r\n```javascript\r\nclient.on('chatMessage', async (message) => {\r\n    // Command system example\r\n    const commands = {\r\n        '!ping': () => 'Pong! 🏓',\r\n        '!discord': () => 'Join our Discord: discord.gg/example'\r\n    };\r\n\r\n    const command = message.content.toLowerCase();\r\n    if (commands[command]) {\r\n        await client.sendChatMessage({\r\n            content: commands[command](),\r\n            type: 'bot'\r\n        });\r\n    }\r\n});\r\n```\r\n\r\n## 🎯 Event Subscriptions\r\n\r\n### Available Events\r\n```javascript\r\nconst AVAILABLE_EVENTS = {\r\n    'chat.message.sent',        // New chat messages\r\n    'channel.followed',         // When someone follows the channel\r\n    'channel.subscription.renewal', // Subscription renewals\r\n    'channel.subscription.gifts',   // Gifted subscriptions\r\n    'channel.subscription.new'      // New subscriptions\r\n};\r\n```\r\n\r\n### Managing Subscriptions\r\n\r\n```javascript\r\n// Get current subscriptions\r\nconst currentSubs = await client.getEventSubscriptions();\r\nconsole.log('Current subscriptions:', currentSubs);\r\n\r\n// Subscribe to specific events\r\nconst subscription = await client.subscribeToEvents([\r\n    'chat.message.sent',\r\n    'channel.followed'\r\n]);\r\n\r\n// Subscribe with custom webhook method\r\nconst webhookSub = await client.subscribeToEvents([\r\n    'channel.subscription.new', \r\n    'channel.subscription.gifts'\r\n]);\r\n\r\n// Unsubscribe from events\r\nawait client.unsubscribeFromEvents(['subscription-id-1', 'subscription-id-2']);\r\n```\r\n\r\n### Event Validation\r\n\r\n```javascript\r\n// Validate incoming webhook\r\nconst isValid = await client.validateWebhook(headers, rawBody);\r\nif (isValid) {\r\n    console.log('Valid webhook event!');\r\n}\r\n```\r\n\r\n### Full Subscription Example\r\n\r\n```javascript\r\nconst client = new KickClient({\r\n    token: 'your-api-token',\r\n    webhookPort: 3000,\r\n    webhookPath: '/webhook',\r\n    webhookBaseUrl: 'https://your-domain.com'\r\n});\r\n\r\n// Start webhook server\r\nawait client.startWebhookServer();\r\n\r\n// Subscribe to multiple events\r\nawait client.subscribeToEvents([\r\n    'chat.message.sent',\r\n    'channel.followed',\r\n    'subscription.new',\r\n    'subscription.renewal',\r\n    'subscription.gifts'\r\n]);\r\n\r\n// Handle different events\r\nclient.on('chatMessage', msg => {\r\n    console.log(`Chat: ${msg.sender.username}: ${msg.content}`);\r\n});\r\n\r\nclient.on('channelFollowed', data => {\r\n    console.log(`New follower: ${data.follower.username}`);\r\n});\r\n\r\nclient.on('subscriptionNew', sub => {\r\n    console.log(`New sub: ${sub.subscriber.username}`);\r\n});\r\n\r\nclient.on('subscriptionRenewal', renewal => {\r\n    console.log(`Renewal: ${renewal.subscriber.username}`);\r\n});\r\n\r\nclient.on('subscriptionGifts', gifts => {\r\n    console.log(`${gifts.gifter.username} gifted ${gifts.giftees.length} subs!`);\r\n});\r\n\r\n// Error handling\r\nclient.on('error', error => {\r\n    console.error('Subscription error:', error);\r\n});\r\n```\r\n\r\n### Webhook Payload Examples\r\n\r\n#### Chat Message Event\r\n```javascript\r\n{\r\n    eventType: 'chat.message.sent',\r\n    payload: {\r\n        messageId: '123456',\r\n        content: 'Hello world!',\r\n        sender: {\r\n            id: '789',\r\n            username: 'username',\r\n            displayName: 'Display Name'\r\n        },\r\n        emotes: [\r\n            {\r\n                id: '123',\r\n                name: 'Kappa',\r\n                position: { start: 6, end: 11 }\r\n            }\r\n        ]\r\n    }\r\n}\r\n```\r\n\r\n#### Follow Event\r\n```javascript\r\n{\r\n    eventType: 'channel.followed',\r\n    payload: {\r\n        broadcaster: {\r\n            id: '123',\r\n            username: 'broadcaster'\r\n        },\r\n        follower: {\r\n            id: '456',\r\n            username: 'follower'\r\n        }\r\n    }\r\n}\r\n```\r\n\r\n#### Subscription Event\r\n```javascript\r\n{\r\n    eventType: 'subscription.new',\r\n    payload: {\r\n        broadcaster: {\r\n            id: '123',\r\n            username: 'broadcaster'\r\n        },\r\n        subscriber: {\r\n            id: '456',\r\n            username: 'subscriber'\r\n        },\r\n        tier: 1,\r\n        months: 1\r\n    }\r\n}\r\n```\r\n\r\n## 📺 Channel Management\r\n\r\n### Get Channel Info\r\n```javascript\r\n// Get single channel\r\nconst channel = await client.getChannels(['123456']);\r\n\r\n// Get multiple channels\r\nconst channels = await client.getChannels(['123', '456', '789']);\r\n```\r\n\r\n### Update Channel\r\n```javascript\r\n// Update stream title and category\r\nawait client.updateChannel({\r\n    categoryId: '123',\r\n    streamTitle: '🔴 New Stream Title!'\r\n});\r\n\r\n// Update just title\r\nawait client.updateChannel({\r\n    streamTitle: '🔴 Playing Games!'\r\n});\r\n```\r\n\r\n## 🎮 Category System\r\n\r\n### Search Categories\r\n```javascript\r\n// Search all categories\r\nconst allCategories = await client.searchCategories();\r\n\r\n// Search specific game\r\nconst gaming = await client.searchCategories('Minecraft');\r\n\r\n// Get category by ID\r\nconst category = await client.getCategory('123');\r\n```\r\n\r\n## 👥 User Management\r\n\r\n### Get User Information\r\n```javascript\r\n// Get single user\r\nconst user = await client.getUsers(['123456']);\r\n\r\n// Get multiple users\r\nconst users = await client.getUsers(['123', '456', '789']);\r\n```\r\n\r\n## 🚨 Error Handling\r\n\r\n```javascript\r\ntry {\r\n    await client.sendChatMessage({\r\n        content: 'Test message'\r\n    });\r\n} catch (error) {\r\n    if (error instanceof UnauthorizedError) {\r\n        console.error('Token is invalid or expired');\r\n    } else if (error instanceof ForbiddenError) {\r\n        console.error('Insufficient permissions');\r\n    } else if (error instanceof RateLimitError) {\r\n        console.error(`Rate limited. Try again in ${error.retryAfter} seconds`);\r\n    } else {\r\n        console.error('Unknown error:', error.message);\r\n    }\r\n}\r\n```\r\n\r\n## 📝 TypeScript Support\r\n\r\n```typescript\r\nimport { \r\n    KickClient, \r\n    ChatMessageOptions,\r\n    ChannelUpdateOptions,\r\n    WebhookEventType\r\n} from '@botk4cp3r/kick.js';\r\n\r\n// Client with typed options\r\nconst client = new KickClient({\r\n    token: string,\r\n    webhookPort: number,\r\n    webhookPath: string,\r\n    webhookBaseUrl: string\r\n});\r\n\r\n// Typed message options\r\nconst messageOptions: ChatMessageOptions = {\r\n    content: string,\r\n    type: 'bot' | 'user',\r\n    broadcasterUserId?: string\r\n};\r\n\r\n// Typed event handlers\r\nclient.on('chatMessage', (message: ChatMessage) => {\r\n    console.log(message.content);\r\n});\r\n```\r\n\r\n## 📚 Examples\r\n\r\n### Chat Bot Example\r\n```javascript\r\nconst { KickClient } = require('@botk4cp3r/kick.js');\r\n\r\nconst client = new KickClient({\r\n    token: 'your-api-token',\r\n    webhookPort: 3000,\r\n    webhookPath: '/webhook',\r\n    webhookBaseUrl: 'http://your-domain.com'\r\n});\r\n\r\nconst commands = {\r\n    '!help': 'Available commands: !help, !ping',\r\n    '!ping': 'Pong! 🏓'\r\n};\r\n\r\nasync function startBot() {\r\n    try {\r\n        // Start webhook server\r\n        await client.startWebhookServer();\r\n        \r\n        // Subscribe to events\r\n        await client.subscribeToEvents([\r\n            'chat.message.sent',\r\n            'channel.followed',\r\n            'channel.subscription.new',\r\n            'channel.subscription.renewal',\r\n            'channel.subscription.gifts'\r\n        ]);\r\n\r\n        console.log('Bot started and subscribed to events!');\r\n    } catch (error) {\r\n        console.error('Failed to start bot:', error);\r\n        process.exit(1);\r\n    }\r\n}\r\n\r\n// Chat command handler\r\nclient.on('chatMessage', async (message) => {\r\n    const command = message.content.toLowerCase();\r\n    \r\n    if (commands[command]) {\r\n        await client.sendChatMessage({\r\n            content: commands[command],\r\n            type: 'bot'\r\n        });\r\n    }\r\n});\r\n\r\n// Event handlers\r\nclient.on('channelFollowed', async (data) => {\r\n    await client.sendChatMessage({\r\n        content: `Thanks for following, ${data.follower.username}! 🎉`,\r\n        type: 'bot'\r\n    });\r\n});\r\n\r\nclient.on('subscriptionNew', async (data) => {\r\n    await client.sendChatMessage({\r\n        content: `Welcome to the team, ${data.subscriber.username}! 🎈`,\r\n        type: 'bot'\r\n    });\r\n});\r\n\r\nclient.on('subscriptionRenewal', async (data) => {\r\n    await client.sendChatMessage({\r\n        content: `Thanks for resubbing, ${data.subscriber.username}! 💜`,\r\n        type: 'bot'\r\n    });\r\n});\r\n\r\nclient.on('subscriptionGifts', async (data) => {\r\n    await client.sendChatMessage({\r\n        content: `Thanks ${data.gifter.username} for gifting ${data.giftees.length} subs! 🎁`,\r\n        type: 'bot'\r\n    });\r\n});\r\n\r\nstartBot().catch(console.error);\r\n```\r\n","readmeFilename":"README.md"}