Files
bot_Laytho/utils/subscribeToEvents.js
2023-05-09 00:32:43 +02:00

21 lines
567 B
JavaScript

const axios = require('axios')
module.exports = async function (access_token, session_id, client_id, type, version, condition) {
return await axios.post('https://api.twitch.tv/helix/eventsub/subscriptions', {
type,
version,
condition,
transport: {
method: 'websocket',
session_id
}
}, {
headers: {
'Authorization': `Bearer ${access_token}`,
'Client-Id': client_id,
'Content-Type': 'application/json'
}
}).then(response => {
return response.data.data[0].status
}).catch(error => { return error.response.data })
}