21 lines
567 B
JavaScript
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 })
|
|
} |