Remove token creation from index
This commit is contained in:
parent
107fb69730
commit
3e8b17360e
22
index.js
22
index.js
|
@ -8,6 +8,9 @@ import { Client, Collection, GatewayIntentBits } from 'discord.js';
|
||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
config();
|
config();
|
||||||
|
|
||||||
|
import { igdb } from './igdb.js';
|
||||||
|
export const igdbHelper = new igdb();
|
||||||
|
|
||||||
// Create a new client instance
|
// Create a new client instance
|
||||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
||||||
|
|
||||||
|
@ -49,23 +52,4 @@ for (const file of eventFiles) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(
|
|
||||||
`https://id.twitch.tv/oauth2/token?client_id=${process.env.igdbClientId}&client_secret=${process.env.igdbClientSecret}&grant_type=client_credentials`,
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.then(r => r.json().then(data => ({ status: r.status, headers: r.headers, body: data })))
|
|
||||||
.then(resp => {
|
|
||||||
if (resp.status != 200) {
|
|
||||||
console.log('Failed with ', resp.status, resp.body);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log(resp.body.access_token);
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.error(err);
|
|
||||||
})
|
|
||||||
.finally();
|
|
||||||
|
|
||||||
client.login(process.env.token);
|
client.login(process.env.token);
|
Loading…
Reference in New Issue