Remove token creation from index

This commit is contained in:
baz 2023-11-20 22:07:05 +00:00
parent 107fb69730
commit 3e8b17360e
1 changed files with 3 additions and 19 deletions

View File

@ -8,6 +8,9 @@ import { Client, Collection, GatewayIntentBits } from 'discord.js';
import { config } from 'dotenv';
config();
import { igdb } from './igdb.js';
export const igdbHelper = new igdb();
// Create a new client instance
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);