@@ -9,7 +9,6 @@ import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.ab
99import dayjs from 'dayjs' ;
1010import { Integration } from '@prisma/client' ;
1111import { KickDto } from '@gitroom/nestjs-libraries/dtos/posts/providers-settings/kick.dto' ;
12- import { Tool } from '@gitroom/nestjs-libraries/integrations/tool.decorator' ;
1312import { createHash , randomBytes } from 'crypto' ;
1413
1514export class KickProvider extends SocialAbstract implements SocialProvider {
@@ -154,55 +153,13 @@ export class KickProvider extends SocialAbstract implements SocialProvider {
154153 } ;
155154 }
156155
157- @Tool ( {
158- description : 'Get list of channels/broadcasters the user can post to' ,
159- dataSchema : [ ] ,
160- } )
161- async channels ( accessToken : string , params : any , id : string ) {
162- // For Kick, when using a user token, we need to know which broadcaster to post to
163- // The user posting as themselves would post to their own channel
164- // Try to get channels the user has access to
165-
166- try {
167- const response = await fetch ( 'https://api.kick.com/public/v1/channels' , {
168- method : 'GET' ,
169- headers : {
170- Authorization : `Bearer ${ accessToken } ` ,
171- } ,
172- } ) ;
173-
174- if ( response . ok ) {
175- const data = await response . json ( ) ;
176- const channels = data . data || [ ] ;
177- return channels . map ( ( channel : any ) => ( {
178- id : String (
179- channel . broadcaster_user_id || channel . user_id || channel . id
180- ) ,
181- name : channel . slug || channel . username || channel . name ,
182- } ) ) ;
183- }
184- } catch ( e ) {
185- // Fall back to returning the authenticated user's info
186- }
187-
188- // If no channels found, return the user's own channel
189- // The id parameter is the user's own ID from authentication
190- return [
191- {
192- id : id ,
193- name : 'My Channel' ,
194- } ,
195- ] ;
196- }
197-
198156 async post (
199157 id : string ,
200158 accessToken : string ,
201159 postDetails : PostDetails [ ] ,
202160 integration : Integration
203161 ) : Promise < PostResponse [ ] > {
204162 const [ firstPost ] = postDetails ;
205- const broadcasterUserId = firstPost . settings . broadcasterUserId ;
206163
207164 // Post chat message to Kick
208165 // Note: Kick chat doesn't support media attachments directly in messages
@@ -215,7 +172,7 @@ export class KickProvider extends SocialAbstract implements SocialProvider {
215172 body : JSON . stringify ( {
216173 type : 'user' ,
217174 content : firstPost . message . substring ( 0 , 500 ) , // Ensure max length
218- broadcaster_user_id : parseInt ( broadcasterUserId , 10 ) ,
175+ broadcaster_user_id : parseInt ( id , 10 ) ,
219176 } ) ,
220177 } ) ;
221178
@@ -240,7 +197,6 @@ export class KickProvider extends SocialAbstract implements SocialProvider {
240197 integration : Integration
241198 ) : Promise < PostResponse [ ] > {
242199 const [ commentPost ] = postDetails ;
243- const broadcasterUserId = commentPost . settings . broadcasterUserId ;
244200
245201 // Kick supports reply_to_message_id for replies
246202 const response = await this . fetch ( 'https://api.kick.com/public/v1/chat' , {
@@ -252,7 +208,7 @@ export class KickProvider extends SocialAbstract implements SocialProvider {
252208 body : JSON . stringify ( {
253209 type : 'user' ,
254210 content : commentPost . message . substring ( 0 , 500 ) ,
255- broadcaster_user_id : parseInt ( broadcasterUserId , 10 ) ,
211+ broadcaster_user_id : parseInt ( id , 10 ) ,
256212 reply_to_message_id : lastCommentId || postId ,
257213 } ) ,
258214 } ) ;
0 commit comments