Traitement commandes et ajout J/arrow + Fix login

This commit is contained in:
Zachary Guénot
2023-05-13 23:10:13 +02:00
parent 05d0b36cc8
commit 34b262a153
13 changed files with 319 additions and 144 deletions

View File

@@ -1,13 +1,14 @@
const axios = require('axios')
module.exports = getUserInfo = (async (client_id, access_token) => {
return await axios.get(`https://api.twitch.tv/helix/users`, {
module.exports = getUserInfo = (async (client_id, access_token, type) => {
return await axios.get('https://api.twitch.tv/helix/users', {
headers: {
'Authorization': `Bearer ${access_token}`,
'Client-Id': client_id
}
}).then(response => {
//console.log(response.data)
return response.data.data[0]
if (type === 'login') return response.data.data[0].login
if (type === 'id') return response.data.data[0].id
}).catch(error => { console.log(error.response.data) })
})