@@ -50,7 +50,7 @@ export async function getTwitchId(login: string) {
5050        Authorization : `Bearer ${ token . token [ "access_token" ] }  , 
5151        "Client-Id" : TWITCH_CLIENT_ID , 
5252      } , 
53-     } 
53+     } , 
5454  ) ; 
5555
5656  const  json  =  ( await  response . json ( ) )  as  any ; 
@@ -75,7 +75,7 @@ export async function timeout(
7575  broadcasterId : string , 
7676  userId : string , 
7777  length : number , 
78-   reason : string 
78+   reason : string , 
7979)  { 
8080  const  profile  =  await  admin . firestore ( ) . collection ( "profiles" ) . doc ( uid ) . get ( ) ; 
8181  if  ( ! profile . exists )  { 
@@ -97,15 +97,15 @@ export async function timeout(
9797          reason, 
9898        } , 
9999      } ) , 
100-     } 
100+     } , 
101101  ) ; 
102102  return  await  response . json ( ) ; 
103103} 
104104
105105export  async  function  unban ( 
106106  uid : string , 
107107  broadcasterId : string , 
108-   userId : string 
108+   userId : string , 
109109)  { 
110110  const  profile  =  await  admin . firestore ( ) . collection ( "profiles" ) . doc ( uid ) . get ( ) ; 
111111  if  ( ! profile . exists )  { 
@@ -120,7 +120,7 @@ export async function unban(
120120    { 
121121      method : "DELETE" , 
122122      headers : await  getHeaders ( uid ) , 
123-     } 
123+     } , 
124124  ) ; 
125125  return  await  response . json ( ) ; 
126126} 
@@ -135,19 +135,24 @@ export async function ban(uid: string, broadcasterId: string, userId: string) {
135135    return ; 
136136  } 
137137  const  response  =  await  fetch ( 
138-     `https://api.twitch.tv/helix/moderation/bans?broadcaster_id=${ broadcasterId } ${ moderatorId } &user_id= ${ userId }  , 
138+     `https://api.twitch.tv/helix/moderation/bans?broadcaster_id=${ broadcasterId } ${ moderatorId }  , 
139139    { 
140-       method : "DELETE " , 
140+       method : "POST " , 
141141      headers : await  getHeaders ( uid ) , 
142-     } 
142+       body : JSON . stringify ( { 
143+         data : { 
144+           user_id : userId , 
145+         } , 
146+       } ) , 
147+     } , 
143148  ) ; 
144149  return  await  response . json ( ) ; 
145150} 
146151
147152export  async  function  deleteMessage ( 
148153  uid : string , 
149154  broadcasterId : string , 
150-   messageId : string 
155+   messageId : string , 
151156)  { 
152157  const  profile  =  await  admin . firestore ( ) . collection ( "profiles" ) . doc ( uid ) . get ( ) ; 
153158  if  ( ! profile . exists )  { 
@@ -162,15 +167,15 @@ export async function deleteMessage(
162167    { 
163168      method : "DELETE" , 
164169      headers : await  getHeaders ( uid ) , 
165-     } 
170+     } , 
166171  ) ; 
167172  return  await  response . json ( ) ; 
168173} 
169174
170175export  async  function  raid ( 
171176  uid : string , 
172177  fromBroadcasterId : string , 
173-   toBroadcasterId : string 
178+   toBroadcasterId : string , 
174179)  { 
175180  const  profile  =  await  admin . firestore ( ) . collection ( "profiles" ) . doc ( uid ) . get ( ) ; 
176181  if  ( ! profile . exists )  { 
@@ -182,7 +187,7 @@ export async function raid(
182187    { 
183188      method : "POST" , 
184189      headers : await  getHeaders ( uid ) , 
185-     } 
190+     } , 
186191  ) ; 
187192  return  await  response . json ( ) ; 
188193} 
0 commit comments