Skip to content

Commit

Permalink
prettify code
Browse files Browse the repository at this point in the history
  • Loading branch information
jellz committed May 15, 2020
1 parent a19580f commit e198a2b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,19 @@ if (argv.setserver) {
if (typeof argv.setserver !== 'string')
return console.error('Server name must be a string'.bold.red);
(async () => {
const res = await fetch(`${MINEHUT_API_BASE}/server/${argv.setserver}?byName=true`);
if (!res.ok) throw new HttpError(`Bad response when fetching server ID: ${res.status}`);
const json = await res.json();
config.set('server_id', json.server._id);
console.log(`Set server ID to ${json.server._id} (${json.server.name})`.green);
})();
const res = await fetch(
`${MINEHUT_API_BASE}/server/${argv.setserver}?byName=true`
);
if (!res.ok)
throw new HttpError(
`Bad response when fetching server ID: ${res.status}`
);
const json = await res.json();
config.set('server_id', json.server._id);
console.log(
`Set server ID to ${json.server._id} (${json.server.name})`.green
);
})();
showHelpCommand = false;
}

Expand Down

0 comments on commit e198a2b

Please sign in to comment.