This commit is contained in:
2024-02-01 12:57:32 +01:00
committed by AdrienLSH
parent 910a8861e5
commit 22dd4a0299
14 changed files with 67 additions and 40 deletions

View File

@ -5,7 +5,7 @@ class Profile
/**
* @param {Client} client
*/
constructor (client, username, id = undefined, avatar_url = undefined)
constructor (client, username=undefined, id=undefined, avatar_url=undefined)
{
/**
* @type {Client} client
@ -36,7 +36,11 @@ class Profile
async init()
{
let response = await this.client._get(`/api/profiles/${this.username}`);
let response;
if (this.username !== undefined)
response = await this.client._get(`/api/profiles/${this.username}`);
else
response = await this.client._get(`/api/profiles/id/${this.id}`);
if (response.status !== 200)
return response.status;