Apply linter to beatGame command
This commit is contained in:
parent
ca68c4a017
commit
94eb85f7f4
|
@ -16,19 +16,19 @@ module.exports = {
|
|||
|
||||
if (!gamename && !gameid) return interaction.reply('No gamename or gameid supplied, please supply an option to register a game!');
|
||||
|
||||
let body = "";
|
||||
let body = '';
|
||||
|
||||
if (gameid) {
|
||||
body = body.concat('where id = ', gameid,'; ');
|
||||
body = body.concat('where id = ', gameid, '; ');
|
||||
} else if (gamename) {
|
||||
body = body.concat('search "', gamename,'"; ');
|
||||
body = body.concat('search "', gamename, '"; ');
|
||||
}
|
||||
|
||||
body = body.concat('fields *;');
|
||||
|
||||
let res = await getGameJson(body);
|
||||
const res = await getGameJson(body);
|
||||
|
||||
if (!res[0]) return interaction.reply("No game found for the options supplied.");
|
||||
if (!res[0]) return interaction.reply('No game found for the options supplied.');
|
||||
|
||||
const coverUrl = await getCoverURL(res[0].cover);
|
||||
|
||||
|
@ -49,14 +49,14 @@ async function getGameJson(body) {
|
|||
let res;
|
||||
|
||||
await fetch(
|
||||
"https://api.igdb.com/v4/games",
|
||||
'https://api.igdb.com/v4/games',
|
||||
{ method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Client-ID': `${process.env.igdbClientId}`,
|
||||
'Authorization': `Bearer ${process.env.igdbAccessToken}`,
|
||||
},
|
||||
body: body
|
||||
body: body,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
|
@ -72,14 +72,14 @@ async function getGameJson(body) {
|
|||
async function getPlatformID(platform) {
|
||||
|
||||
await fetch(
|
||||
"https://api.igdb.com/v4/platforms",
|
||||
'https://api.igdb.com/v4/platforms',
|
||||
{ method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Client-ID': `${process.env.igdbClientId}`,
|
||||
'Authorization': `Bearer ${process.env.igdbAccessToken}`,
|
||||
},
|
||||
body: `where name = "${platform}", alternative_name = "${platform}"; fields id;`
|
||||
body: `where name = "${platform}", alternative_name = "${platform}"; fields id;`,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
|
@ -91,17 +91,17 @@ async function getPlatformID(platform) {
|
|||
}
|
||||
|
||||
async function getCoverURL(id) {
|
||||
let url = "https://upload.wikimedia.org/wikipedia/commons/d/d1/Image_not_available.png";
|
||||
let url = 'https://upload.wikimedia.org/wikipedia/commons/d/d1/Image_not_available.png';
|
||||
|
||||
await fetch(
|
||||
"https://api.igdb.com/v4/covers",
|
||||
'https://api.igdb.com/v4/covers',
|
||||
{ method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Client-ID': `${process.env.igdbClientId}`,
|
||||
'Authorization': `Bearer ${process.env.igdbAccessToken}`,
|
||||
},
|
||||
body: `where id = ${id}; fields url;`
|
||||
body: `where id = ${id}; fields url;`,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
|
|
Loading…
Reference in New Issue