Files
bot_Laytho/utils/subscribeToEvent.js
Zachary Guénot be73cd765d first commit
2023-05-08 04:47:30 +02:00

24 lines
666 B
JavaScript

const axios = require('axios')
module.exports = async (access_token, session_id, client_id) => {
await axios.post('https://api.twitch.tv/helix/eventsub/subscriptions', {
type: 'channel.channel_points_custom_reward_redemption.add',
version: '1',
condition: {
broadcaster_user_id: '1337',
reward_id: 'abcf127c-7326-4483-a52b-b0da0be61c01'
},
transport: {
method: 'websocket',
session_id
}
}, {
headers: {
'Authorization': `Bearer ${access_token}`,
'Client-Id': client_id,
'Content-Type': 'application/json'
}
}).then(response => {
console.log(response.data)
}).catch(error => { console.log(error) })
}